Skip to content

Commit 0b589b1

Browse files
committed
Merge from 'main' to 'sycl-web' (24 commits)
CONFLICT (content): Merge conflict in clang/lib/CodeGen/CodeGenFunction.cpp
2 parents 1550e57 + 970bf07 commit 0b589b1

File tree

102 files changed

+2216
-1063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+2216
-1063
lines changed

clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ bool ExtractionContext::exprIsValidOutside(const clang::Stmt *Scope) const {
176176
SourceLocation ScopeBegin = Scope->getBeginLoc();
177177
SourceLocation ScopeEnd = Scope->getEndLoc();
178178
for (const Decl *ReferencedDecl : ReferencedDecls) {
179-
if (SM.isPointWithin(ReferencedDecl->getBeginLoc(), ScopeBegin, ScopeEnd) &&
179+
if (ReferencedDecl->getBeginLoc().isValid() &&
180+
SM.isPointWithin(ReferencedDecl->getBeginLoc(), ScopeBegin, ScopeEnd) &&
180181
SM.isPointWithin(ReferencedDecl->getEndLoc(), ScopeBegin, ScopeEnd))
181182
return false;
182183
}

clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ TEST_F(ExtractVariableTest, Test) {
6464
int x = [[1]];
6565
})cpp";
6666
EXPECT_AVAILABLE(AvailableC);
67+
68+
ExtraArgs = {"-xc"};
69+
const char *NoCrashCasesC = R"cpp(
70+
// error-ok: broken code, but shouldn't crash
71+
int x = [[foo()]];
72+
)cpp";
73+
EXPECT_UNAVAILABLE(NoCrashCasesC);
74+
6775
ExtraArgs = {"-xobjective-c"};
6876
const char *AvailableObjC = R"cpp(
6977
__attribute__((objc_root_class))

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,11 +1501,6 @@ void CodeGenFunction::EmitFunctionBody(const Stmt *Body) {
15011501
EmitCompoundStmtWithoutScope(*S);
15021502
else
15031503
EmitStmt(Body);
1504-
1505-
// This is checked after emitting the function body so we know if there
1506-
// are any permitted infinite loops.
1507-
if (checkIfFunctionMustProgress())
1508-
CurFn->addFnAttr(llvm::Attribute::MustProgress);
15091504
}
15101505

15111506
/// When instrumenting to collect profile data, the counts for some blocks
@@ -1724,6 +1719,11 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
17241719
(FD->hasAttr<CUDADeviceAttr>() || FD->hasAttr<CUDAHostAttr>()))
17251720
Fn->setLinkage(llvm::Function::WeakODRLinkage);
17261721

1722+
// Ensure that the function adheres to the forward progress guarantee, which
1723+
// is required by certain optimizations.
1724+
if (checkIfFunctionMustProgress())
1725+
CurFn->addFnAttr(llvm::Attribute::MustProgress);
1726+
17271727
// Generate the body of the function.
17281728
PGO.assignRegionCounters(GD, CurFn);
17291729
if (isa<CXXDestructorDecl>(FD))

clang/test/Analysis/builtin_signbit.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// RUN: -O0 %s -o - | FileCheck %s --check-prefixes=CHECK-BE64
66
// RUN: %clang -target powerpc64le-linux-gnu -emit-llvm -S -mabi=ibmlongdouble \
77
// RUN: -O0 %s -o - | FileCheck %s --check-prefixes=CHECK-LE
8+
// REQUIRES: asserts
89

910
bool b;
1011
double d = -1.0;

clang/test/CXX/special/class.dtor/p3-0x.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,4 @@ struct TVC : VX
176176
template <typename T>
177177
TVC<T>::~TVC() {}
178178

179-
// CHECK: attributes [[ATTRGRP]] = { noinline nounwind{{.*}} }
179+
// CHECK: attributes [[ATTRGRP]] = { mustprogress noinline nounwind{{.*}} }

clang/test/CodeGen/fp-floatcontrol-stack.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ float fun_default FUN(1)
224224
#endif
225225
float y();
226226
// CHECK-DDEFAULT: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
227-
// CHECK-DEBSTRICT: Function Attrs: noinline nounwind optnone strictfp{{$$}}
227+
// CHECK-DEBSTRICT: Function Attrs: mustprogress noinline nounwind optnone strictfp{{$$}}
228228
// CHECK-FAST: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
229229
// CHECK-NOHONOR: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
230230
class ON {
@@ -246,10 +246,10 @@ class ON {
246246
};
247247
ON on;
248248
#pragma float_control(except, off)
249-
// CHECK-DDEFAULT: Function Attrs: noinline nounwind optnone{{$$}}
250-
// CHECK-DEBSTRICT: Function Attrs: noinline nounwind optnone{{$$}}
251-
// CHECK-FAST: Function Attrs: noinline nounwind optnone{{$$}}
252-
// CHECK-NOHONOR: Function Attrs: noinline nounwind optnone{{$$}}
249+
// CHECK-DDEFAULT: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
250+
// CHECK-DEBSTRICT: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
251+
// CHECK-FAST: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
252+
// CHECK-NOHONOR: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
253253
class OFF {
254254
float w = 2 + y() * 7;
255255
// CHECK-LABEL: define {{.*}} void @_ZN3OFFC2Ev{{.*}}

clang/test/CodeGen/no-builtin.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,23 @@ extern "C" void call_b_foo(B *b) {
4242

4343
// CHECK-LABEL: define{{.*}} void @call_foo_no_mempcy() #3
4444
extern "C" void call_foo_no_mempcy() {
45-
// CHECK: call void @foo_no_mempcy() #7
45+
// CHECK: call void @foo_no_mempcy() #6
4646
foo_no_mempcy(); // call gets annotated with "no-builtin-memcpy"
4747
}
4848

4949
A::~A() {} // Anchoring A so A::foo() gets generated
5050
B::~B() {} // Anchoring B so B::foo() gets generated
5151

5252
// CHECK-LABEL: define linkonce_odr noundef i32 @_ZNK1A3fooEv(ptr noundef{{[^,]*}} %this) unnamed_addr #0 comdat align 2
53-
// CHECK-LABEL: define linkonce_odr noundef i32 @_ZNK1B3fooEv(ptr noundef{{[^,]*}} %this) unnamed_addr #6 comdat align 2
53+
// CHECK-LABEL: define linkonce_odr noundef i32 @_ZNK1B3fooEv(ptr noundef{{[^,]*}} %this) unnamed_addr #5 comdat align 2
5454

5555
// CHECK: attributes #0 = {{{.*}}"no-builtin-memcpy"{{.*}}}
5656
// CHECK-NOT: attributes #0 = {{{.*}}"no-builtin-memmove"{{.*}}}
5757
// CHECK-NOT: attributes #0 = {{{.*}}"no-builtin-memset"{{.*}}}
5858
// CHECK: attributes #1 = {{{.*}}"no-builtins"{{.*}}}
5959
// CHECK: attributes #2 = {{{.*}}"no-builtin-memcpy"{{.*}}"no-builtin-memset"{{.*}}}
6060
// CHECK-NOT: attributes #2 = {{{.*}}"no-builtin-memmove"{{.*}}}
61-
// CHECK: attributes #6 = {{{.*}}"no-builtin-memmove"{{.*}}}
61+
// CHECK: attributes #6 = {{{.*}}"no-builtin-memcpy"{{.*}}}
6262
// CHECK-NOT: attributes #5 = {{{.*}}"no-builtin-memcpy"{{.*}}}
6363
// CHECK-NOT: attributes #5 = {{{.*}}"no-builtin-memset"{{.*}}}
64-
// CHECK: attributes #7 = { "no-builtin-memcpy" }
64+
// CHECK: attributes #8 = { builtin nounwind }

clang/test/CodeGenCXX/apple-kext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ namespace test0 {
3838
// CHECK: call void @_ZN5test01AD1Ev(ptr @_ZN5test01aE)
3939
// CHECK-NEXT: ret void
4040

41-
// CHECK: attributes #[[ATTR0]] = { alwaysinline nounwind {{.*}} }
42-
// CHECK: attributes #[[ATTR1]] = { noinline nounwind {{.*}} }
41+
// CHECK: attributes #[[ATTR0]] = { alwaysinline mustprogress nounwind {{.*}} }
42+
// CHECK: attributes #[[ATTR1]] = { mustprogress noinline nounwind {{.*}} }

clang/test/OpenMP/assumes_codegen.cpp

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,29 +115,29 @@ int lambda_outer() {
115115
// CHECK: define{{.*}} void @_Z3barv()
116116
// CHECK-SAME: [[attr1:#[0-9]]]
117117
// CHECK: call{{.*}} @_ZN3BARC1Ev(ptr{{.*}} %b)
118-
// CHECK-SAME: [[attr9:#[0-9]]]
118+
// CHECK-SAME: [[attr8:#[0-9]]]
119119
// CHECK: define{{.*}} void @_ZN3BARC1Ev(ptr{{.*}} %this)
120-
// CHECK-SAME: [[attr2:#[0-9]]]
120+
// CHECK-SAME: [[attr1:#[0-9]]]
121121
// CHECK: call{{.*}} @_ZN3BARC2Ev(ptr{{.*}} %this1)
122-
// CHECK-SAME: [[attr9]]
122+
// CHECK-SAME: [[attr8]]
123123
// CHECK: define{{.*}} void @_ZN3BARC2Ev(ptr{{.*}} %this)
124-
// CHECK-SAME: [[attr3:#[0-9]]]
124+
// CHECK-SAME: [[attr2:#[0-9]]]
125125
// CHECK: define{{.*}} void @_Z3bazv()
126-
// CHECK-SAME: [[attr4:#[0-9]]]
126+
// CHECK-SAME: [[attr3:#[0-9]]]
127127
// CHECK: call{{.*}} @_ZN3BAZIfEC1Ev(ptr{{.*}} %b)
128-
// CHECK-SAME: [[attr10:#[0-9]]]
128+
// CHECK-SAME: [[attr9:#[0-9]]]
129129
// CHECK: define{{.*}} void @_ZN3BAZIfEC1Ev(ptr{{.*}} %this)
130-
// CHECK-SAME: [[attr5:#[0-9]]]
130+
// CHECK-SAME: [[attr4:#[0-9]]]
131131
// CHECK: call{{.*}} @_ZN3BAZIfEC2Ev(ptr{{.*}} %this1)
132-
// CHECK-SAME: [[attr10]]
132+
// CHECK-SAME: [[attr9]]
133133
// CHECK: define{{.*}} void @_ZN3BAZIfEC2Ev(ptr{{.*}} %this)
134-
// CHECK-SAME: [[attr6:#[0-9]]]
134+
// CHECK-SAME: [[attr5:#[0-9]]]
135135
// CHECK: define{{.*}} i32 @_Z12lambda_outerv()
136-
// CHECK-SAME: [[attr7:#[0-9]]]
136+
// CHECK-SAME: [[attr6:#[0-9]]]
137137
// CHECK: call{{.*}} @"_ZZ12lambda_outervENK3$_0clEv"
138-
// CHECK-SAME: [[attr11:#[0-9]]]
138+
// CHECK-SAME: [[attr10:#[0-9]]]
139139
// CHECK: define{{.*}} i32 @"_ZZ12lambda_outervENK3$_0clEv"(ptr{{.*}} %this)
140-
// CHECK-SAME: [[attr8:#[0-9]]]
140+
// CHECK-SAME: [[attr7:#[0-9]]]
141141

142142
// CHECK: attributes [[attr0]]
143143
// CHECK-SAME: "llvm.assume"="omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp"
@@ -146,20 +146,18 @@ int lambda_outer() {
146146
// CHECK: attributes [[attr2]]
147147
// CHECK-SAME: "llvm.assume"="ompx_range_bar_only,ompx_range_bar_only_2,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp"
148148
// CHECK: attributes [[attr3]]
149-
// CHECK-SAME: "llvm.assume"="ompx_range_bar_only,ompx_range_bar_only_2,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp"
150-
// CHECK: attributes [[attr4]]
151149
// CHECK-SAME: "llvm.assume"="ompx_1234,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp,ompx_1234,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp"
150+
// CHECK: attributes [[attr4]]
151+
// CHECK-SAME: "llvm.assume"="ompx_1234,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp"
152152
// CHECK: attributes [[attr5]]
153153
// CHECK-SAME: "llvm.assume"="ompx_1234,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp"
154154
// CHECK: attributes [[attr6]]
155-
// CHECK-SAME: "llvm.assume"="ompx_1234,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp"
155+
// CHECK-SAME: "llvm.assume"="ompx_lambda_assumption,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp"
156156
// CHECK: attributes [[attr7]]
157157
// CHECK-SAME: "llvm.assume"="ompx_lambda_assumption,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp"
158158
// CHECK: attributes [[attr8]]
159-
// CHECK-SAME: "llvm.assume"="ompx_lambda_assumption,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp"
160-
// CHECK: attributes [[attr9]]
161159
// CHECK-SAME: "llvm.assume"="ompx_range_bar_only,ompx_range_bar_only_2,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp"
162-
// CHECK: attributes [[attr10]]
160+
// CHECK: attributes [[attr9]]
163161
// CHECK-SAME: "llvm.assume"="ompx_1234,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp"
164-
// CHECK: attributes [[attr11]]
162+
// CHECK: attributes [[attr10]]
165163
// CHECK-SAME: "llvm.assume"="ompx_lambda_assumption,omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses,omp_no_openmp"

clang/test/OpenMP/for_firstprivate_codegen.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ int main() {
412412
//
413413
//
414414
// CHECK1-LABEL: define {{[^@]+}}@_Z5tmainIiET_v
415-
// CHECK1-SAME: () #[[ATTR6:[0-9]+]] {
415+
// CHECK1-SAME: () #[[ATTR1]] {
416416
// CHECK1-NEXT: entry:
417417
// CHECK1-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
418418
// CHECK1-NEXT: [[TEST:%.*]] = alloca [[STRUCT_S_0:%.*]], align 4
@@ -514,7 +514,7 @@ int main() {
514514
//
515515
//
516516
// CHECK1-LABEL: define {{[^@]+}}@_Z5tmainIiET_v.omp_outlined
517-
// CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[T_VAR:%.*]], ptr noundef nonnull align 4 dereferenceable(8) [[VEC:%.*]], ptr noundef nonnull align 4 dereferenceable(8) [[S_ARR:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[VAR:%.*]]) #[[ATTR7:[0-9]+]] {
517+
// CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[T_VAR:%.*]], ptr noundef nonnull align 4 dereferenceable(8) [[VEC:%.*]], ptr noundef nonnull align 4 dereferenceable(8) [[S_ARR:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[VAR:%.*]]) #[[ATTR6:[0-9]+]] {
518518
// CHECK1-NEXT: entry:
519519
// CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
520520
// CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
@@ -1013,7 +1013,7 @@ int main() {
10131013
//
10141014
//
10151015
// CHECK4-LABEL: define {{[^@]+}}@__main_block_invoke
1016-
// CHECK4-SAME: (ptr noundef [[DOTBLOCK_DESCRIPTOR:%.*]]) #[[ATTR1]] {
1016+
// CHECK4-SAME: (ptr noundef [[DOTBLOCK_DESCRIPTOR:%.*]]) #[[ATTR4:[0-9]+]] {
10171017
// CHECK4-NEXT: entry:
10181018
// CHECK4-NEXT: [[DOTBLOCK_DESCRIPTOR_ADDR:%.*]] = alloca ptr, align 8
10191019
// CHECK4-NEXT: [[BLOCK_ADDR:%.*]] = alloca ptr, align 8
@@ -1024,7 +1024,7 @@ int main() {
10241024
//
10251025
//
10261026
// CHECK4-LABEL: define {{[^@]+}}@__main_block_invoke.omp_outlined
1027-
// CHECK4-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR4:[0-9]+]] {
1027+
// CHECK4-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR5:[0-9]+]] {
10281028
// CHECK4-NEXT: entry:
10291029
// CHECK4-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
10301030
// CHECK4-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
@@ -1129,7 +1129,7 @@ int main() {
11291129
//
11301130
//
11311131
// CHECK4-LABEL: define {{[^@]+}}@var_block_invoke
1132-
// CHECK4-SAME: (ptr noundef [[DOTBLOCK_DESCRIPTOR:%.*]]) #[[ATTR1]] {
1132+
// CHECK4-SAME: (ptr noundef [[DOTBLOCK_DESCRIPTOR:%.*]]) #[[ATTR4]] {
11331133
// CHECK4-NEXT: entry:
11341134
// CHECK4-NEXT: [[DOTBLOCK_DESCRIPTOR_ADDR:%.*]] = alloca ptr, align 8
11351135
// CHECK4-NEXT: [[BLOCK_ADDR:%.*]] = alloca ptr, align 8

0 commit comments

Comments
 (0)