Skip to content

Commit f1650cf

Browse files
authored
Revert "[clang] Convert second arg of __builtin_assume_aligned to ConstantExpr (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.
1 parent 819f34a commit f1650cf

File tree

3 files changed

+0
-11
lines changed

3 files changed

+0
-11
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,6 @@ Non-comprehensive list of changes in this release
246246

247247
- ``__builtin_assume_dereferenceable`` now accepts non-constant size operands.
248248

249-
- Fixed a crash when the second argument to ``__builtin_assume_aligned`` was not constant (#GH161314)
250-
251249
New Compiler Flags
252250
------------------
253251
- 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``).

clang/lib/Sema/SemaChecking.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5954,9 +5954,6 @@ bool Sema::BuiltinAssumeAligned(CallExpr *TheCall) {
59545954
if (Result > Sema::MaximumAlignment)
59555955
Diag(TheCall->getBeginLoc(), diag::warn_assume_aligned_too_great)
59565956
<< SecondArg->getSourceRange() << Sema::MaximumAlignment;
5957-
5958-
TheCall->setArg(1,
5959-
ConstantExpr::Create(Context, SecondArg, APValue(Result)));
59605957
}
59615958

59625959
if (NumArgs > 2) {

clang/test/SemaCXX/builtin-assume-aligned.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,3 @@ constexpr void *s1 = __builtin_assume_aligned(x, 32);
4747
constexpr void *s2 = __builtin_assume_aligned(x, 32, 5);
4848
constexpr void *s3 = __builtin_assume_aligned(x, 32, -1);
4949

50-
51-
constexpr int add(int a, int b) {
52-
return a+b;
53-
}
54-
constexpr void *c1 = __builtin_assume_aligned(p, add(1,1));
55-
constexpr void *c2 = __builtin_assume_aligned(p, add(2,1)); // expected-error {{not a power of 2}}

0 commit comments

Comments
 (0)