Skip to content

Conversation

DKLoehr
Copy link
Contributor

@DKLoehr DKLoehr commented Oct 2, 2025

This reverts commit 8f77621 (#161314).

Reason: Causing crashes when building https://github.com/google/highway. See the original PR for details.

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

llvmbot commented Oct 2, 2025

@llvm/pr-subscribers-clang

Author: Devon Loehr (DKLoehr)

Changes

This reverts commit 8f77621 (#161314).

Reason: Causing crashes when building https://github.com/google/highway. See the original PR for details.


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

3 Files Affected:

  • (modified) clang/docs/ReleaseNotes.rst (-2)
  • (modified) clang/lib/Sema/SemaChecking.cpp (-3)
  • (modified) clang/test/SemaCXX/builtin-assume-aligned.cpp (-6)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 74b0647f38795..145a83af514ed 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -246,8 +246,6 @@ Non-comprehensive list of changes in this release
 
 - ``__builtin_assume_dereferenceable`` now accepts non-constant size operands.
 
-- Fixed a crash when the second argument to ``__builtin_assume_aligned`` was not constant (#GH161314)
-
 New Compiler Flags
 ------------------
 - New option ``-fno-sanitize-debug-trap-reasons`` added to disable emitting trap reasons into the debug info when compiling with trapping UBSan (e.g. ``-fsanitize-trap=undefined``).
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 3cc61b167ba98..7ce3513fe0969 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5954,9 +5954,6 @@ bool Sema::BuiltinAssumeAligned(CallExpr *TheCall) {
     if (Result > Sema::MaximumAlignment)
       Diag(TheCall->getBeginLoc(), diag::warn_assume_aligned_too_great)
           << SecondArg->getSourceRange() << Sema::MaximumAlignment;
-
-    TheCall->setArg(1,
-                    ConstantExpr::Create(Context, SecondArg, APValue(Result)));
   }
 
   if (NumArgs > 2) {
diff --git a/clang/test/SemaCXX/builtin-assume-aligned.cpp b/clang/test/SemaCXX/builtin-assume-aligned.cpp
index afc11cc694705..48bd8414fc50a 100644
--- a/clang/test/SemaCXX/builtin-assume-aligned.cpp
+++ b/clang/test/SemaCXX/builtin-assume-aligned.cpp
@@ -47,9 +47,3 @@ constexpr void *s1 = __builtin_assume_aligned(x, 32);
 constexpr void *s2 = __builtin_assume_aligned(x, 32, 5);
 constexpr void *s3 = __builtin_assume_aligned(x, 32, -1);
 
-
-constexpr int add(int a, int b) {
-  return a+b;
-}
-constexpr void *c1 = __builtin_assume_aligned(p, add(1,1));
-constexpr void *c2 = __builtin_assume_aligned(p, add(2,1)); // expected-error {{not a power of 2}}

@DKLoehr DKLoehr merged commit f1650cf into llvm:main Oct 2, 2025
11 of 12 checks passed
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
…stantExpr (llvm#161314)" (llvm#161719)

This reverts commit 8f77621 (llvm#161314).

Reason: Causing crashes when building https://github.com/google/highway.
See the original PR for details.
tbaederr added a commit to tbaederr/llvm-project that referenced this pull request Oct 4, 2025
tbaederr added a commit that referenced this pull request Oct 5, 2025
aokblast pushed a commit to aokblast/llvm-project that referenced this pull request Oct 6, 2025
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants