[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-03-19 Thread Daniel Kiss via cfe-commits
DanielKristofKiss wrote: > This still has "foo"="true" style function attributes, which are problematic. > Is the plan to change that? Can be changed to just "foo" just makes the function/module attribute importer more complicated to handle the old IR.

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-03-19 Thread Daniel Kiss via cfe-commits
@@ -1398,6 +1400,42 @@ class TargetInfo : public TransferrableTargetInfo, } llvm_unreachable("Unexpected SignReturnAddressKeyKind"); } + + public: +BranchProtectionInfo() = default; DanielKristofKiss wrote: We need the default

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-03-19 Thread Nick Desaulniers via cfe-commits
@@ -1398,6 +1400,42 @@ class TargetInfo : public TransferrableTargetInfo, } llvm_unreachable("Unexpected SignReturnAddressKeyKind"); } + + public: +BranchProtectionInfo() = default; nickdesaulniers wrote: Do we still need the default

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-03-19 Thread Nick Desaulniers via cfe-commits
@@ -43,4 +49,4 @@ // BTE-NOT: !"sign-return-address-with-bkey" // B-KEY: !{i32 8, !"sign-return-address-with-bkey", i32 1} -void foo() {} +void foo() {} nickdesaulniers wrote: retain newline at EOF https://github.com/llvm/llvm-project/pull/82819

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-03-19 Thread Nick Desaulniers via cfe-commits
@@ -116,37 +116,22 @@ class AArch64TargetCodeGenInfo : public TargetCodeGenInfo { if (!FD) return; -const auto *TA = FD->getAttr(); -if (TA == nullptr) - return; - -ParsedTargetAttr Attr = -

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-03-19 Thread Nick Desaulniers via cfe-commits
https://github.com/nickdesaulniers commented: This still has "foo"="true" style function attributes, which are problematic. Is the plan to change that? https://github.com/llvm/llvm-project/pull/82819 ___ cfe-commits mailing list

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-03-19 Thread Nick Desaulniers via cfe-commits
https://github.com/nickdesaulniers edited https://github.com/llvm/llvm-project/pull/82819 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-03-01 Thread via cfe-commits
https://github.com/DanielKristofKiss updated https://github.com/llvm/llvm-project/pull/82819 >From 9e844b9e61ad1c81983aafd7ac9b3fb9e1939787 Mon Sep 17 00:00:00 2001 From: Daniel Kiss Date: Mon, 22 Jan 2024 11:33:15 +0100 Subject: [PATCH] Emit attributes for functions always. Branch

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-03-01 Thread via cfe-commits
@@ -1369,13 +1369,50 @@ class TargetInfo : public TransferrableTargetInfo, } struct BranchProtectionInfo { -LangOptions::SignReturnAddressScopeKind SignReturnAddr = -LangOptions::SignReturnAddressScopeKind::None; -LangOptions::SignReturnAddressKeyKind

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-29 Thread Nick Desaulniers via cfe-commits
@@ -173,6 +167,13 @@ class ARMTargetCodeGenInfo : public TargetCodeGenInfo { diag::warn_target_unsupported_branch_protection_attribute) << Attr.CPU; } +} else if (CGM.getTarget().isBranchProtectionSupportedArch( +

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-29 Thread Nick Desaulniers via cfe-commits
@@ -173,6 +167,13 @@ class ARMTargetCodeGenInfo : public TargetCodeGenInfo { diag::warn_target_unsupported_branch_protection_attribute) << Attr.CPU; } +} else if (CGM.getTarget().isBranchProtectionSupportedArch( +

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-29 Thread Nick Desaulniers via cfe-commits
@@ -109,38 +109,29 @@ class AArch64TargetCodeGenInfo : public TargetCodeGenInfo { if (!FD) return; -const auto *TA = FD->getAttr(); -if (TA == nullptr) - return; - -ParsedTargetAttr Attr = -

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-29 Thread Nick Desaulniers via cfe-commits
@@ -1369,13 +1369,50 @@ class TargetInfo : public TransferrableTargetInfo, } struct BranchProtectionInfo { -LangOptions::SignReturnAddressScopeKind SignReturnAddr = -LangOptions::SignReturnAddressScopeKind::None; -LangOptions::SignReturnAddressKeyKind

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-29 Thread Nick Desaulniers via cfe-commits
@@ -1369,13 +1369,50 @@ class TargetInfo : public TransferrableTargetInfo, } struct BranchProtectionInfo { -LangOptions::SignReturnAddressScopeKind SignReturnAddr = -LangOptions::SignReturnAddressScopeKind::None; -LangOptions::SignReturnAddressKeyKind

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-28 Thread via cfe-commits
https://github.com/DanielKristofKiss updated https://github.com/llvm/llvm-project/pull/82819 >From c5c2d720e822624fa7966297087b04e6b2fc2a86 Mon Sep 17 00:00:00 2001 From: Daniel Kiss Date: Fri, 23 Feb 2024 17:12:26 +0100 Subject: [PATCH 1/4] [NFC][ARM][AArch64] Deduplicated code. Add the

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-28 Thread via cfe-commits
DanielKristofKiss wrote: This handles the synthetic function in clang: #83277 https://github.com/llvm/llvm-project/pull/82819 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-27 Thread via cfe-commits
DanielKristofKiss wrote: Function attributes are only attached when they are set. #83153 ensures the synthetic function are also gets the right attributes so the backend doesn't need to use the module attributes #83154. https://github.com/llvm/llvm-project/pull/82819

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-27 Thread via cfe-commits
https://github.com/DanielKristofKiss updated https://github.com/llvm/llvm-project/pull/82819 >From c5c2d720e822624fa7966297087b04e6b2fc2a86 Mon Sep 17 00:00:00 2001 From: Daniel Kiss Date: Fri, 23 Feb 2024 17:12:26 +0100 Subject: [PATCH 1/2] [NFC][ARM][AArch64] Deduplicated code. Add the

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-25 Thread via cfe-commits
@@ -138,58 +163,79 @@ void run_foo_tml() { // CHECK: resolver_return1: // CHECK-NEXT:ret ptr @_ZN7MyClassIisE7foo_tmlEv._Mfrintts // CHECK: resolver_else2: -// CHECK-NEXT:ret ptr @_ZN7MyClassIisE7foo_tmlEv +// CHECK-NEXT:ret ptr

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-25 Thread via cfe-commits
@@ -0,0 +1,16 @@ +// REQUIRES: arm-registered-target + +// RUN: %clang -flto -target thumbv7m-unknown-unknown-eabi -mbranch-protection=pac-ret %s -S -o - 2>&1 | FileCheck %s DanielKristofKiss wrote: Done https://github.com/llvm/llvm-project/pull/82819

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-25 Thread via cfe-commits
https://github.com/DanielKristofKiss updated https://github.com/llvm/llvm-project/pull/82819 >From c5c2d720e822624fa7966297087b04e6b2fc2a86 Mon Sep 17 00:00:00 2001 From: Daniel Kiss Date: Fri, 23 Feb 2024 17:12:26 +0100 Subject: [PATCH 1/3] [NFC][ARM][AArch64] Deduplicated code. Add the

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-24 Thread Fangrui Song via cfe-commits
@@ -138,58 +163,79 @@ void run_foo_tml() { // CHECK: resolver_return1: // CHECK-NEXT:ret ptr @_ZN7MyClassIisE7foo_tmlEv._Mfrintts // CHECK: resolver_else2: -// CHECK-NEXT:ret ptr @_ZN7MyClassIisE7foo_tmlEv +// CHECK-NEXT:ret ptr

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-24 Thread Fangrui Song via cfe-commits
@@ -138,58 +163,79 @@ void run_foo_tml() { // CHECK: resolver_return1: // CHECK-NEXT:ret ptr @_ZN7MyClassIisE7foo_tmlEv._Mfrintts // CHECK: resolver_else2: -// CHECK-NEXT:ret ptr @_ZN7MyClassIisE7foo_tmlEv +// CHECK-NEXT:ret ptr

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-24 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,16 @@ +// REQUIRES: arm-registered-target + +// RUN: %clang -flto -target thumbv7m-unknown-unknown-eabi -mbranch-protection=pac-ret %s -S -o - 2>&1 | FileCheck %s MaskRay wrote: prefer `--target=` for new tests For codegen tests we prefer

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-23 Thread via cfe-commits
DanielKristofKiss wrote: RFC as I'm not sure the right approach is to emit that many attribute always. LLVM's Function::createWithDefaultAttr to be extended too with propagation of the module flags to the function. https://github.com/llvm/llvm-project/pull/82819

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-23 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: Dani (DanielKristofKiss) Changes Branch protection, sign return address, guarded control stack attributes are only emitted as module flags if not specified per function. The inliner might inline functions with different set of

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-23 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-backend-arm @llvm/pr-subscribers-clang Author: Dani (DanielKristofKiss) Changes Branch protection, sign return address, guarded control stack attributes are only emitted as module flags if not specified per function. The inliner might inline

[clang] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

2024-02-23 Thread via cfe-commits
https://github.com/DanielKristofKiss created https://github.com/llvm/llvm-project/pull/82819 Branch protection, sign return address, guarded control stack attributes are only emitted as module flags if not specified per function. The inliner might inline functions with different set of