Skip to content

Revert "[TargetVersion] Only enable on RISC-V and AArch64" #117110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

BeMg
Copy link
Contributor

@BeMg BeMg commented Nov 21, 2024

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Nov 21, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 21, 2024

@llvm/pr-subscribers-clang

Author: Piyou Chen (BeMg)

Changes

Reverts llvm/llvm-project#115991

Due to build fail https://lab.llvm.org/buildbot/#/builders/66/builds/6511


Full diff: https://github.com/llvm/llvm-project/pull/117110.diff

3 Files Affected:

  • (modified) clang/docs/ReleaseNotes.rst (-2)
  • (modified) clang/include/clang/Basic/Attr.td (+1-1)
  • (removed) clang/test/Sema/attr-target-version-unsupported.c (-4)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index a2ff05438c949a..999c88455b64a5 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -459,8 +459,6 @@ Attribute Changes in Clang
 - Clang now supports ``[[clang::lifetime_capture_by(X)]]``. Similar to lifetimebound, this can be
   used to specify when a reference to a function parameter is captured by another capturing entity ``X``.
 
-- The ``target_version`` attribute is now only supported for AArch64 and RISC-V architectures.
-
 Improvements to Clang's diagnostics
 -----------------------------------
 
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td
index f1780fa1067352..634253d0032560 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -3297,7 +3297,7 @@ def Target : InheritableAttr {
   }];
 }
 
-def TargetVersion : DeclOrTypeAttr, TargetSpecificAttr<TargetArch<!listconcat(TargetAArch64.Arches, TargetRISCV.Arches)>> {
+def TargetVersion : InheritableAttr {
   let Spellings = [GCC<"target_version">];
   let Args = [StringArgument<"NamesStr">];
   let Subjects = SubjectList<[Function], ErrorDiag>;
diff --git a/clang/test/Sema/attr-target-version-unsupported.c b/clang/test/Sema/attr-target-version-unsupported.c
deleted file mode 100644
index 7cf8172f5272e6..00000000000000
--- a/clang/test/Sema/attr-target-version-unsupported.c
+++ /dev/null
@@ -1,4 +0,0 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s
-
-//expected-warning@+1 {{unknown attribute 'target_version' ignored}}
-int __attribute__((target_version("aes"))) foo(void) { return 3; }

@BeMg BeMg added the skip-precommit-approval PR for CI feedback, not intended for review label Nov 21, 2024
@BeMg BeMg merged commit c4be13c into main Nov 21, 2024
10 of 12 checks passed
@BeMg BeMg deleted the revert-115991-PR-fix-x86-target-version-crash branch November 21, 2024 04:48
BeMg added a commit to BeMg/llvm-project that referenced this pull request Nov 21, 2024
…7110)"

origin messenge

[TargetVersion] Only enable on RISC-V and AArch64 (llvm#115991)
Address llvm#115000.

This patch constrains the target_version feature to work only on RISC-V
and AArch64 to prevent crashes in Clang.

---------

Co-authored-by: Aaron Ballman <[email protected]>
BeMg added a commit that referenced this pull request Nov 25, 2024
…" (#117128)

Remain InheritableAttr to avoid the warning `TypePrinter.cpp:1953:10:
warning: enumeration value ‘TargetVersion’ not handled in switch`

origin messenge

[TargetVersion] Only enable on RISC-V and AArch64 (#115991) Address
#115000.

This patch constrains the target_version feature to work only on RISC-V
and AArch64 to prevent crashes in Clang.

Co-authored-by: Aaron Ballman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category skip-precommit-approval PR for CI feedback, not intended for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants