[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 30 06:36:31 PDT 2024
https://github.com/cor3ntin updated https://github.com/llvm/llvm-project/pull/90066
>From a89ed3064119d110da2289e78bb85630342a2b18 Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Thu, 25 Apr 2024 16:34:29 +0200
Subject: [PATCH 1/8] [Clang] Implement P2809: Trivial infinite loops are not
Undefined Behavior
https://wg21.link/P2809R3
---
clang/docs/ReleaseNotes.rst | 4 +-
clang/lib/CodeGen/CGStmt.cpp | 81 ++++++++++++++++++---
clang/lib/CodeGen/CodeGenFunction.cpp | 1 +
clang/lib/CodeGen/CodeGenFunction.h | 23 +-----
clang/test/CodeGenCXX/attr-mustprogress.cpp | 70 ++++++++----------
clang/www/cxx_status.html | 2 +-
6 files changed, 107 insertions(+), 74 deletions(-)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 64526ed6d06f55..f5906c2dd4eb52 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -122,7 +122,7 @@ C++23 Feature Support
materialize temporary object which is a prvalue in discarded-value expression.
- Implemented `P1774R8: Portable assumptions <https://wg21.link/P1774R8>`_.
-- Implemented `P2448R2: Relaxing some constexpr restrictions <https://wg21.link/P2448R2>`_.
+- Implemented `P2809R3: Trivial infinite loops are not Undefined Behavior <https://wg21.link/P2809R3>`_.
C++2c Feature Support
^^^^^^^^^^^^^^^^^^^^^
@@ -131,6 +131,8 @@ C++2c Feature Support
- Implemented `P2573R2: = delete("should have a reason"); <https://wg21.link/P2573R2>`_
+- Implemented `P2573R2: = delete("should have a reason"); <https://wg21.link/P2573R2>`_
+
Resolutions to C++ Defect Reports
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 576fe2f7a2d46f..7a0ad8a73b9fce 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -908,6 +908,73 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
incrementProfileCounter(&S);
}
+bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression,
+ bool IsTrivialCXXLoop) {
+ if (CGM.getCodeGenOpts().getFiniteLoops() ==
+ CodeGenOptions::FiniteLoopsKind::Always)
+ return true;
+ if (CGM.getCodeGenOpts().getFiniteLoops() ==
+ CodeGenOptions::FiniteLoopsKind::Never)
+ return false;
+
+ // Now apply rules for plain C (see 6.8.5.6 in C11).
+ // Loops with constant conditions do not have to make progress in any C
+ // version.
+ // As an extension, we consisider loops whose constant expression
+ // can be constant-folded.
+ Expr::EvalResult Result;
+ bool CondIsConstInt =
+ !ControllingExpression ||
+ (ControllingExpression->EvaluateAsInt(Result, getContext()) &&
+ Result.Val.isInt());
+ bool IsTrue = CondIsConstInt &&
+ (!ControllingExpression || Result.Val.getInt().getBoolValue());
+
+ if (getLangOpts().C99 && CondIsConstInt)
+ return false;
+
+ // Loops with non-constant conditions must make progress in C11 and later.
+ if (getLangOpts().C11)
+ return true;
+
+ // [C++26][intro.progress] (DR)
+ // The implementation may assume that any thread will eventually do one of the
+ // following:
+ // [...]
+ // - continue execution of a trivial infinite loop ([stmt.iter.general]).
+ if (getLangOpts().CPlusPlus11) {
+ if (IsTrivialCXXLoop && IsTrue) {
+ CurFn->removeFnAttr(llvm::Attribute::MustProgress);
+ return false;
+ }
+ return true;
+ }
+
+ return false;
+}
+
+// [C++26][stmt.iter.general] (DR)
+// A trivially empty iteration statement is an iteration statement matching one
+// of the following forms:
+// - while ( expression ) ;
+// - while ( expression ) { }
+// - do ; while ( expression ) ;
+// - do { } while ( expression ) ;
+// - for ( init-statement expression(opt); ) ;
+// - for ( init-statement expression(opt); ) { }
+template <typename LoopStmt> static bool hasEmptyLoopBody(const LoopStmt &S) {
+ if constexpr (std::is_same_v<LoopStmt, ForStmt>) {
+ if (S.getInc())
+ return false;
+ }
+ const Stmt *Body = S.getBody();
+ if (!Body || isa<NullStmt>(Body))
+ return true;
+ if (const CompoundStmt *Compound = dyn_cast<CompoundStmt>(Body))
+ return Compound->body_empty();
+ return false;
+}
+
void CodeGenFunction::EmitWhileStmt(const WhileStmt &S,
ArrayRef<const Attr *> WhileAttrs) {
// Emit the header for the loop, which will also become
@@ -942,13 +1009,12 @@ void CodeGenFunction::EmitWhileStmt(const WhileStmt &S,
// while(1) is common, avoid extra exit blocks. Be sure
// to correctly handle break/continue though.
llvm::ConstantInt *C = dyn_cast<llvm::ConstantInt>(BoolCondVal);
- bool CondIsConstInt = C != nullptr;
- bool EmitBoolCondBranch = !CondIsConstInt || !C->isOne();
+ bool EmitBoolCondBranch = !C || !C->isOne();
const SourceRange &R = S.getSourceRange();
LoopStack.push(LoopHeader.getBlock(), CGM.getContext(), CGM.getCodeGenOpts(),
WhileAttrs, SourceLocToDebugLoc(R.getBegin()),
SourceLocToDebugLoc(R.getEnd()),
- checkIfLoopMustProgress(CondIsConstInt));
+ checkIfLoopMustProgress(S.getCond(), hasEmptyLoopBody(S)));
// When single byte coverage mode is enabled, add a counter to loop condition.
if (llvm::EnableSingleByteCoverage)
@@ -1059,14 +1125,13 @@ void CodeGenFunction::EmitDoStmt(const DoStmt &S,
// "do {} while (0)" is common in macros, avoid extra blocks. Be sure
// to correctly handle break/continue though.
llvm::ConstantInt *C = dyn_cast<llvm::ConstantInt>(BoolCondVal);
- bool CondIsConstInt = C;
bool EmitBoolCondBranch = !C || !C->isZero();
const SourceRange &R = S.getSourceRange();
LoopStack.push(LoopBody, CGM.getContext(), CGM.getCodeGenOpts(), DoAttrs,
SourceLocToDebugLoc(R.getBegin()),
SourceLocToDebugLoc(R.getEnd()),
- checkIfLoopMustProgress(CondIsConstInt));
+ checkIfLoopMustProgress(S.getCond(), hasEmptyLoopBody(S)));
// As long as the condition is true, iterate the loop.
if (EmitBoolCondBranch) {
@@ -1109,15 +1174,11 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S,
llvm::BasicBlock *CondBlock = CondDest.getBlock();
EmitBlock(CondBlock);
- Expr::EvalResult Result;
- bool CondIsConstInt =
- !S.getCond() || S.getCond()->EvaluateAsInt(Result, getContext());
-
const SourceRange &R = S.getSourceRange();
LoopStack.push(CondBlock, CGM.getContext(), CGM.getCodeGenOpts(), ForAttrs,
SourceLocToDebugLoc(R.getBegin()),
SourceLocToDebugLoc(R.getEnd()),
- checkIfLoopMustProgress(CondIsConstInt));
+ checkIfLoopMustProgress(S.getCond(), hasEmptyLoopBody(S)));
// Create a cleanup scope for the condition variable cleanups.
LexicalScope ConditionScope(*this, S.getSourceRange());
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 86a6ddd80cc114..95c0784ad9760c 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1465,6 +1465,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
// Ensure that the function adheres to the forward progress guarantee, which
// is required by certain optimizations.
+ // The attribute will be removed if the body contains a trivial empty loop.
if (checkIfFunctionMustProgress())
CurFn->addFnAttr(llvm::Attribute::MustProgress);
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index ff1873325d409f..f0e8e47bc0e420 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -635,28 +635,7 @@ class CodeGenFunction : public CodeGenTypeCache {
/// Returns true if a loop must make progress, which means the mustprogress
/// attribute can be added. \p HasConstantCond indicates whether the branch
/// condition is a known constant.
- bool checkIfLoopMustProgress(bool HasConstantCond) {
- if (CGM.getCodeGenOpts().getFiniteLoops() ==
- CodeGenOptions::FiniteLoopsKind::Always)
- return true;
- if (CGM.getCodeGenOpts().getFiniteLoops() ==
- CodeGenOptions::FiniteLoopsKind::Never)
- return false;
-
- // If the containing function must make progress, loops also must make
- // progress (as in C++11 and later).
- if (checkIfFunctionMustProgress())
- return true;
-
- // Now apply rules for plain C (see 6.8.5.6 in C11).
- // Loops with constant conditions do not have to make progress in any C
- // version.
- if (HasConstantCond)
- return false;
-
- // Loops with non-constant conditions must make progress in C11 and later.
- return getLangOpts().C11;
- }
+ bool checkIfLoopMustProgress(const Expr *, bool IsTrivialCXXLoop);
const CodeGen::CGBlockInfo *BlockInfo = nullptr;
llvm::Value *BlockPointer = nullptr;
diff --git a/clang/test/CodeGenCXX/attr-mustprogress.cpp b/clang/test/CodeGenCXX/attr-mustprogress.cpp
index 843f5460426ccf..5a24e9426d1308 100644
--- a/clang/test/CodeGenCXX/attr-mustprogress.cpp
+++ b/clang/test/CodeGenCXX/attr-mustprogress.cpp
@@ -24,21 +24,21 @@ int b = 0;
// CHECK: datalayout
// CXX98-NOT: mustprogress
-// CXX11: mustprogress
+// CXX11-NOT: mustprogress
// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2f0v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %for.cond
// CHECK: for.cond:
// CXX98-NOT: br {{.*}} llvm.loop
-// CXX11-NEXT: br label %for.cond, !llvm.loop [[LOOP1:!.*]]
+// CXX11-NOT: br {{.*}} llvm.loop
// FINITE-NEXT: br label %for.cond, !llvm.loop [[LOOP1:!.*]]
void f0() {
for (; ;) ;
}
// CXX98-NOT: mustprogress
-// CXX11: mustprogress
+// CXX11-NOT: mustprogress
// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2f1v(
// CHECK-NEXT: entry:
@@ -46,8 +46,8 @@ void f0() {
// CHECK: for.cond:
// CHECK-NEXT: br i1 true, label %for.body, label %for.end
// CHECK: for.body:
-// CXX98-NOT: br {{.*}}, !llvm.loop
-// CXX11-NEXT: br label %for.cond, !llvm.loop [[LOOP2:!.*]]
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NOT: br {{.*}} llvm.loop
// FINITE-NEXT: br label %for.cond, !llvm.loop [[LOOP2:!.*]]
// CHECK: for.end:
// CHECK-NEXT: ret void
@@ -81,7 +81,7 @@ void f2() {
}
// CXX98-NOT: mustprogress
-// CXX11: mustprogress
+// CXX11-NOT: mustprogress
// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z1Fv(
// CHECK-NEXT: entry:
@@ -90,7 +90,7 @@ void f2() {
// CHECK-NEXT: br i1 true, label %for.body, label %for.end
// CHECK: for.body:
// CXX98-NOT: br {{.*}}, !llvm.loop
-// CXX11-NEXT: br label %for.cond, !llvm.loop [[LOOP4:!.*]]
+// CXX11-NOT: br {{.*}}, !llvm.loop
// FINITE-NEXT: br label %for.cond, !llvm.loop [[LOOP4:!.*]]
// CHECK: for.end:
// CHECK-NEXT: br label %for.cond1
@@ -114,7 +114,7 @@ void F() {
}
// CXX98-NOT: mustprogress
-// CXX11: mustprogress
+// CXX11-NOT: mustprogress
// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2F2v(
// CHECK-NEXT: entry:
@@ -134,7 +134,7 @@ void F() {
// CHECK-NEXT: br i1 true, label %for.body2, label %for.end3
// CHECK: for.body2:
// CXX98-NOT: br {{.*}}, !llvm.loop
-// CXX11-NEXT: br label %for.cond1, !llvm.loop [[LOOP7:!.*]]
+// CXX11-NOT: br {{.*}}, !llvm.loop
// FINITE-NEXT: br label %for.cond1, !llvm.loop [[LOOP7:!.*]]
// CHECK: for.end3:
// CHECK-NEXT: ret void
@@ -147,14 +147,14 @@ void F2() {
}
// CXX98-NOT: mustprogress
-// CXX11: mustprogress
+// CXX11-NOT: mustprogress
// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2w1v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %while.body
// CHECK: while.body:
// CXX98-NOT: br {{.*}}, !llvm.loop
-// CXX11-NEXT: br label %while.body, !llvm.loop [[LOOP8:!.*]]
+// CXX11-NOT: br {{.*}}, !llvm.loop
// FINITE-NEXT: br label %while.body, !llvm.loop [[LOOP8:!.*]]
//
void w1() {
@@ -186,7 +186,7 @@ void w2() {
}
// CXX98-NOT: mustprogress
-// CXX11: mustprogress
+// CXX11-NOT: mustprogress
// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z1Wv(
// CHECK-NEXT: entry:
@@ -204,7 +204,7 @@ void w2() {
// CHECK-NEXT: br label %while.body2
// CHECK: while.body2:
// CXX98-NOT: br {{.*}}, !llvm.loop
-// CXX11-NEXT: br label %while.body2, !llvm.loop [[LOOP11:!.*]]
+// CXX11-NOT: br {{.*}}, !llvm.loop
// FINITE-NEXT: br label %while.body2, !llvm.loop [[LOOP11:!.*]]
//
void W() {
@@ -215,14 +215,14 @@ void W() {
}
// CXX98-NOT: mustprogress
-// CXX11: mustprogress
+// CXX11-NOT: mustprogress
// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2W2v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %while.body
// CHECK: while.body:
// CXX98-NOT: br {{.*}}, !llvm.loop
-// CXX11-NEXT: br label %while.body, !llvm.loop [[LOOP12:!.*]]
+// CXX11-NOT: br label %while.body, !llvm.loop [[LOOP12:!.*]]
// FINITE-NEXT: br label %while.body, !llvm.loop [[LOOP12:!.*]]
//
void W2() {
@@ -233,7 +233,7 @@ void W2() {
}
// CXX98-NOT: mustprogress
-// CXX11: mustprogress
+// CXX11-NOT: mustprogress
// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2d1v(
// CHECK-NEXT: entry:
@@ -242,7 +242,7 @@ void W2() {
// CHECK-NEXT: br label %do.cond
// CHECK: do.cond:
// CXX98-NOT: br {{.*}}, !llvm.loop
-// CXX11-NEXT: br i1 true, label %do.body, label %do.end, !llvm.loop [[LOOP13:!.*]]
+// CXX11-NOT: br {{.*}}, !llvm.loop
// FINITE-NEXT: br i1 true, label %do.body, label %do.end, !llvm.loop [[LOOP13:!.*]]
// CHECK: do.end:
// CHECK-NEXT: ret void
@@ -278,7 +278,7 @@ void d2() {
}
// CXX98-NOT: mustprogress
-// CXX11: mustprogress
+// CXX11-NOT: mustprogress
// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z1Dv(
// CHECK-NEXT: entry:
@@ -287,7 +287,7 @@ void d2() {
// CHECK-NEXT: br label %do.cond
// CHECK: do.cond:
// CXX98-NOT: br {{.*}}, !llvm.loop
-// CXX11-NEXT: br i1 true, label %do.body, label %do.end, !llvm.loop [[LOOP15:!.*]]
+// CXX11-NOT: br {{.*}}, !llvm.loop
// FINITE-NEXT: br i1 true, label %do.body, label %do.end, !llvm.loop [[LOOP15:!.*]]
// CHECK: do.end:
// CHECK-NEXT: br label %do.body1
@@ -312,8 +312,8 @@ void D() {
while (a == b);
}
-// CXX98-NOT : mustprogress
-// CXX11: mustprogress
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2D2v(
// CHECK-NEXT: entry:
@@ -333,7 +333,7 @@ void D() {
// CHECK-NEXT: br label %do.cond2
// CHECK: do.cond2:
// CXX98-NOT: br {{.*}}, !llvm.loop
-// CXX11-NEXT: br i1 true, label %do.body1, label %do.end3, !llvm.loop [[LOOP18:!.*]]
+// CXX11-NOT: br {{.*}}, !llvm.loop
// FINITE-NEXT: br i1 true, label %do.body1, label %do.end3, !llvm.loop [[LOOP18:!.*]]
// CHECK: do.end3:
// CHECK-NEXT: ret void
@@ -347,22 +347,12 @@ void D2() {
while (1);
}
-// CXX11: [[LOOP1]] = distinct !{[[LOOP1]], [[MP:!.*]]}
+// CXX11: [[LOOP1:.*]] = distinct !{[[LOOP1]], [[MP:.*]]}
// CXX11: [[MP]] = !{!"llvm.loop.mustprogress"}
-// CXX11: [[LOOP2]] = distinct !{[[LOOP2]], [[MP]]}
-// CXX11: [[LOOP3]] = distinct !{[[LOOP3]], [[MP]]}
-// CXX11: [[LOOP4]] = distinct !{[[LOOP4]], [[MP]]}
-// CXX11: [[LOOP5]] = distinct !{[[LOOP5]], [[MP]]}
-// CXX11: [[LOOP6]] = distinct !{[[LOOP6]], [[MP]]}
-// CXX11: [[LOOP7]] = distinct !{[[LOOP7]], [[MP]]}
-// CXX11: [[LOOP8]] = distinct !{[[LOOP8]], [[MP]]}
-// CXX11: [[LOOP9]] = distinct !{[[LOOP9]], [[MP]]}
-// CXX11: [[LOOP10]] = distinct !{[[LOOP10]], [[MP]]}
-// CXX11: [[LOOP11]] = distinct !{[[LOOP11]], [[MP]]}
-// CXX11: [[LOOP12]] = distinct !{[[LOOP12]], [[MP]]}
-// CXX11: [[LOOP13]] = distinct !{[[LOOP13]], [[MP]]}
-// CXX11: [[LOOP14]] = distinct !{[[LOOP14]], [[MP]]}
-// CXX11: [[LOOP15]] = distinct !{[[LOOP15]], [[MP]]}
-// CXX11: [[LOOP16]] = distinct !{[[LOOP16]], [[MP]]}
-// CXX11: [[LOOP17]] = distinct !{[[LOOP17]], [[MP]]}
-// CXX11: [[LOOP18]] = distinct !{[[LOOP18]], [[MP]]}
+// CXX11: [[LOOP2:.*]] = distinct !{[[LOOP2]], [[MP]]}
+// CXX11: [[LOOP3:.*]] = distinct !{[[LOOP3]], [[MP]]}
+// CXX11: [[LOOP4:.*]] = distinct !{[[LOOP4]], [[MP]]}
+// CXX11: [[LOOP5:.*]] = distinct !{[[LOOP5]], [[MP]]}
+// CXX11: [[LOOP6:.*]] = distinct !{[[LOOP6]], [[MP]]}
+// CXX11: [[LOOP7:.*]] = distinct !{[[LOOP7]], [[MP]]}
+// CXX11: [[LOOP8:.*]] = distinct !{[[LOOP8]], [[MP]]}
diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index c233171e63c811..0d796597d05c0e 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -187,7 +187,7 @@ <h2 id="cxx26">C++2c implementation status</h2>
<tr>
<td>Trivial infinite loops are not Undefined Behavior</td>
<td><a href="https://wg21.link/P2809R3">P2809R3</a> (<a href="#dr">DR</a>)</td>
- <td class="none" align="center">No</td>
+ <td class="unreleased" align="center">Clang 19</td>
</tr>
<tr>
<td>Erroneous behaviour for uninitialized reads</td>
>From 5671ea9763730f67d406c389ace104e17234f562 Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Mon, 29 Apr 2024 09:44:30 +0200
Subject: [PATCH 2/8] Remove the mustprogress attributes on functions. Whether
a function make progress is determined exclusively by loops metadata.
---
clang/lib/CodeGen/CGStmt.cpp | 9 +--
clang/lib/CodeGen/CodeGenFunction.cpp | 6 --
clang/lib/CodeGen/CodeGenFunction.h | 18 -----
clang/test/CXX/special/class.dtor/p3-0x.cpp | 2 +-
.../aarch64-sme-attrs.cpp | 14 ++--
.../CodeGen/address-safety-attr-flavors.cpp | 70 +++++++++----------
clang/test/CodeGen/address-safety-attr.cpp | 4 +-
.../debug-names-compound-type-units.ll | 4 +-
clang/test/CodeGen/fp-floatcontrol-stack.cpp | 40 +++++------
clang/test/CodeGen/sanitize-thread-attr.cpp | 2 +-
clang/test/CodeGenCXX/apple-kext.cpp | 4 +-
clang/test/CodeGenCXX/attr-mustprogress.cpp | 47 ++-----------
.../CodeGenCXX/attr-target-clones-aarch64.cpp | 10 +--
clang/test/CodeGenCXX/attr-target-version.cpp | 22 +++---
.../test/CodeGenCXX/cxx11-exception-spec.cpp | 2 +-
clang/test/CodeGenCXX/cxx11-noreturn.cpp | 2 +-
clang/test/CodeGenCXX/derived-to-base.cpp | 2 +-
clang/test/CodeGenCXX/main-norecurse.cpp | 2 +-
.../microsoft-abi-array-cookies.cpp | 2 +-
clang/test/CodeGenCXX/no-exceptions.cpp | 4 +-
clang/test/CodeGenCXX/noinline-template.cpp | 2 +-
.../CodeGenCXX/optnone-and-attributes.cpp | 4 +-
clang/test/CodeGenCXX/optnone-def-decl.cpp | 2 +-
clang/test/CodeGenCXX/pr58798.cpp | 20 +++---
clang/test/CodeGenCXX/reference-cast.cpp | 4 +-
clang/test/CodeGenCXX/threadsafe-statics.cpp | 4 +-
clang/test/CodeGenCXX/thunks-ehspec.cpp | 6 +-
clang/test/CodeGenCXX/thunks.cpp | 2 +-
clang/test/CodeGenCXX/virtual-base-cast.cpp | 2 +-
clang/test/CodeGenHIP/default-attributes.hip | 8 +--
.../test/CodeGenObjCXX/lambda-expressions.mm | 4 +-
clang/test/CodeGenSYCL/function-attrs.cpp | 2 +-
clang/test/Modules/aarch64-sme-keywords.cppm | 2 +-
clang/test/OpenMP/amdgcn-attributes.cpp | 18 ++---
clang/test/OpenMP/irbuilder_safelen.cpp | 3 +-
.../irbuilder_safelen_order_concurrent.cpp | 3 +-
clang/test/OpenMP/irbuilder_simd_aligned.cpp | 5 +-
clang/test/OpenMP/irbuilder_simdlen.cpp | 3 +-
.../test/OpenMP/irbuilder_simdlen_safelen.cpp | 3 +-
.../OpenMP/parallel_if_codegen_PR51349.cpp | 4 +-
.../check-attributes.cpp.funcattrs.expected | 2 +-
41 files changed, 148 insertions(+), 221 deletions(-)
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 7a0ad8a73b9fce..f37af32f120728 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -942,13 +942,8 @@ bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression,
// following:
// [...]
// - continue execution of a trivial infinite loop ([stmt.iter.general]).
- if (getLangOpts().CPlusPlus11) {
- if (IsTrivialCXXLoop && IsTrue) {
- CurFn->removeFnAttr(llvm::Attribute::MustProgress);
- return false;
- }
- return true;
- }
+ if (getLangOpts().CPlusPlus11)
+ return !(IsTrivialCXXLoop && IsTrue);
return false;
}
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 95c0784ad9760c..76262b6e0d2c84 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1463,12 +1463,6 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
if (Body && isa_and_nonnull<CoroutineBodyStmt>(Body))
llvm::append_range(FnArgs, FD->parameters());
- // Ensure that the function adheres to the forward progress guarantee, which
- // is required by certain optimizations.
- // The attribute will be removed if the body contains a trivial empty loop.
- if (checkIfFunctionMustProgress())
- CurFn->addFnAttr(llvm::Attribute::MustProgress);
-
// Generate the body of the function.
PGO.assignRegionCounters(GD, CurFn);
if (isa<CXXDestructorDecl>(FD))
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index f0e8e47bc0e420..f8d160c52f5944 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -614,24 +614,6 @@ class CodeGenFunction : public CodeGenTypeCache {
// applies to. nullptr if there is no 'musttail' on the current statement.
const CallExpr *MustTailCall = nullptr;
- /// Returns true if a function must make progress, which means the
- /// mustprogress attribute can be added.
- bool checkIfFunctionMustProgress() {
- if (CGM.getCodeGenOpts().getFiniteLoops() ==
- CodeGenOptions::FiniteLoopsKind::Never)
- return false;
-
- // C++11 and later guarantees that a thread eventually will do one of the
- // following (C++11 [intro.multithread]p24 and C++17 [intro.progress]p1):
- // - terminate,
- // - make a call to a library I/O function,
- // - perform an access through a volatile glvalue, or
- // - perform a synchronization operation or an atomic operation.
- //
- // Hence each function is 'mustprogress' in C++11 or later.
- return getLangOpts().CPlusPlus11;
- }
-
/// Returns true if a loop must make progress, which means the mustprogress
/// attribute can be added. \p HasConstantCond indicates whether the branch
/// condition is a known constant.
diff --git a/clang/test/CXX/special/class.dtor/p3-0x.cpp b/clang/test/CXX/special/class.dtor/p3-0x.cpp
index 857bdca557fdc4..f6a64260e0df53 100644
--- a/clang/test/CXX/special/class.dtor/p3-0x.cpp
+++ b/clang/test/CXX/special/class.dtor/p3-0x.cpp
@@ -176,4 +176,4 @@ struct TVC : VX
template <typename T>
TVC<T>::~TVC() {}
-// CHECK: attributes [[ATTRGRP]] = { mustprogress noinline nounwind{{.*}} }
+// CHECK: attributes [[ATTRGRP]] = { noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/aarch64-sme-attrs.cpp b/clang/test/CodeGen/aarch64-sme-intrinsics/aarch64-sme-attrs.cpp
index fdd2de11365dd4..8fb3b0cac7bb4c 100644
--- a/clang/test/CodeGen/aarch64-sme-intrinsics/aarch64-sme-attrs.cpp
+++ b/clang/test/CodeGen/aarch64-sme-intrinsics/aarch64-sme-attrs.cpp
@@ -278,18 +278,18 @@ int test_variadic_template() __arm_inout("za") {
preserves_za_decl);
}
-// CHECK: attributes #[[SM_ENABLED]] = { mustprogress noinline nounwind "aarch64_pstate_sm_enabled" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[SM_ENABLED]] = { noinline nounwind "aarch64_pstate_sm_enabled" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
// CHECK: attributes #[[NORMAL_DECL]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
// CHECK: attributes #[[SM_ENABLED_DECL]] = { "aarch64_pstate_sm_enabled" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
-// CHECK: attributes #[[SM_COMPATIBLE]] = { mustprogress noinline nounwind "aarch64_pstate_sm_compatible" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[SM_COMPATIBLE]] = { noinline nounwind "aarch64_pstate_sm_compatible" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
// CHECK: attributes #[[SM_COMPATIBLE_DECL]] = { "aarch64_pstate_sm_compatible" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
-// CHECK: attributes #[[SM_BODY]] = { mustprogress noinline nounwind "aarch64_pstate_sm_body" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
-// CHECK: attributes #[[ZA_SHARED]] = { mustprogress noinline nounwind "aarch64_inout_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[SM_BODY]] = { noinline nounwind "aarch64_pstate_sm_body" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[ZA_SHARED]] = { noinline nounwind "aarch64_inout_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
// CHECK: attributes #[[ZA_SHARED_DECL]] = { "aarch64_inout_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
-// CHECK: attributes #[[ZA_PRESERVED]] = { mustprogress noinline nounwind "aarch64_preserves_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[ZA_PRESERVED]] = { noinline nounwind "aarch64_preserves_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
// CHECK: attributes #[[ZA_PRESERVED_DECL]] = { "aarch64_preserves_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
-// CHECK: attributes #[[ZA_NEW]] = { mustprogress noinline nounwind "aarch64_new_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
-// CHECK: attributes #[[NORMAL_DEF]] = { mustprogress noinline nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[ZA_NEW]] = { noinline nounwind "aarch64_new_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[NORMAL_DEF]] = { noinline nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
// CHECK: attributes #[[SM_ENABLED_CALL]] = { "aarch64_pstate_sm_enabled" }
// CHECK: attributes #[[SM_COMPATIBLE_CALL]] = { "aarch64_pstate_sm_compatible" }
// CHECK: attributes #[[SM_BODY_CALL]] = { "aarch64_pstate_sm_body" }
diff --git a/clang/test/CodeGen/address-safety-attr-flavors.cpp b/clang/test/CodeGen/address-safety-attr-flavors.cpp
index ef815555059db8..f14257e718c09b 100644
--- a/clang/test/CodeGen/address-safety-attr-flavors.cpp
+++ b/clang/test/CodeGen/address-safety-attr-flavors.cpp
@@ -25,60 +25,60 @@
// RUN: FileCheck -check-prefix=CHECK-KHWASAN %s
int HasSanitizeAddress() { return 1; }
-// CHECK-NOASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-ASAN: Function Attrs: mustprogress noinline nounwind sanitize_address
-// CHECK-KASAN: Function Attrs: mustprogress noinline nounwind sanitize_address
-// CHECK-HWASAN: Function Attrs: mustprogress noinline nounwind sanitize_hwaddress
-// CHECK-KHWASAN: Function Attrs: mustprogress noinline nounwind sanitize_hwaddress
+// CHECK-NOASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-ASAN: Function Attrs: noinline nounwind sanitize_address
+// CHECK-KASAN: Function Attrs: noinline nounwind sanitize_address
+// CHECK-HWASAN: Function Attrs: noinline nounwind sanitize_hwaddress
+// CHECK-KHWASAN: Function Attrs: noinline nounwind sanitize_hwaddress
__attribute__((no_sanitize("address"))) int NoSanitizeQuoteAddress() {
return 0;
}
-// CHECK-NOASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-ASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-KASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-HWASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_hwaddress$}}
-// CHECK-KHWASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_hwaddress$}}
+// CHECK-NOASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-ASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-KASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-HWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress$}}
+// CHECK-KHWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress$}}
__attribute__((no_sanitize_address)) int NoSanitizeAddress() { return 0; }
-// CHECK-NOASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-ASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-KASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-HWASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_hwaddress$}}
-// CHECK-KHWASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_hwaddress$}}
+// CHECK-NOASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-ASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-KASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-HWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress$}}
+// CHECK-KHWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress$}}
__attribute__((no_sanitize("kernel-address"))) int NoSanitizeKernelAddress() {
return 0;
}
-// CHECK-NOASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-ASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-KASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-HWASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_hwaddress$}}
-// CHECK-KHWASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_hwaddress$}}
+// CHECK-NOASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-ASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-KASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-HWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress$}}
+// CHECK-KHWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress$}}
__attribute__((no_sanitize("hwaddress"))) int NoSanitizeHWAddress() {
return 0;
}
-// CHECK-NOASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-ASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_address$}}
-// CHECK-KASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_address$}}
-// CHECK-HWASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-KHWASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-NOASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-ASAN: {{Function Attrs: noinline nounwind sanitize_address$}}
+// CHECK-KASAN: {{Function Attrs: noinline nounwind sanitize_address$}}
+// CHECK-HWASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-KHWASAN: {{Function Attrs: noinline nounwind$}}
__attribute__((no_sanitize("kernel-hwaddress"))) int NoSanitizeKernelHWAddress() {
return 0;
}
-// CHECK-NOASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-ASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_address$}}
-// CHECK-KASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_address$}}
-// CHECK-HWASAN: {{Function Attrs: mustprogress noinline nounwind$}}
-// CHECK-KHWASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-NOASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-ASAN: {{Function Attrs: noinline nounwind sanitize_address$}}
+// CHECK-KASAN: {{Function Attrs: noinline nounwind sanitize_address$}}
+// CHECK-HWASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-KHWASAN: {{Function Attrs: noinline nounwind$}}
__attribute__((disable_sanitizer_instrumentation)) int DisableSanitizerInstrumentation() {
return 0;
}
-// CHECK-NOASAN: {{Function Attrs: disable_sanitizer_instrumentation mustprogress noinline nounwind$}}
-// CHECK-ASAN: {{Function Attrs: disable_sanitizer_instrumentation mustprogress noinline nounwind$}}
-// CHECK-KASAN: {{Function Attrs: disable_sanitizer_instrumentation mustprogress noinline nounwind$}}
-// CHECK-HWASAN: {{Function Attrs: disable_sanitizer_instrumentation mustprogress noinline nounwind$}}
-// CHECK-KHWASAN: {{Function Attrs: disable_sanitizer_instrumentation mustprogress noinline nounwind$}}
+// CHECK-NOASAN: {{Function Attrs: disable_sanitizer_instrumentation noinline nounwind$}}
+// CHECK-ASAN: {{Function Attrs: disable_sanitizer_instrumentation noinline nounwind$}}
+// CHECK-KASAN: {{Function Attrs: disable_sanitizer_instrumentation noinline nounwind$}}
+// CHECK-HWASAN: {{Function Attrs: disable_sanitizer_instrumentation noinline nounwind$}}
+// CHECK-KHWASAN: {{Function Attrs: disable_sanitizer_instrumentation noinline nounwind$}}
diff --git a/clang/test/CodeGen/address-safety-attr.cpp b/clang/test/CodeGen/address-safety-attr.cpp
index bd899ed2f9a749..7aeda9a80dcd94 100644
--- a/clang/test/CodeGen/address-safety-attr.cpp
+++ b/clang/test/CodeGen/address-safety-attr.cpp
@@ -148,7 +148,7 @@ int global2 = *(int*)((char*)&global1+1);
// BLFILE: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
// BLFUNC: attributes [[WITH]] = { noinline nounwind sanitize_address{{.*}} }
-// BLFUNC: attributes [[NOATTR]] = { mustprogress noinline nounwind{{.*}} }
+// BLFUNC: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
// ASAN: attributes [[WITH]] = { noinline nounwind sanitize_address{{.*}} }
-// ASAN: attributes [[NOATTR]] = { mustprogress noinline nounwind{{.*}} }
+// ASAN: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGen/debug-names-compound-type-units.ll b/clang/test/CodeGen/debug-names-compound-type-units.ll
index 62cecfdeaf7f94..bb9f41b82f061e 100644
--- a/clang/test/CodeGen/debug-names-compound-type-units.ll
+++ b/clang/test/CodeGen/debug-names-compound-type-units.ll
@@ -29,7 +29,7 @@ target triple = "x86_64-unknown-linux-gnu"
%struct.Foo2 = type { i8, %struct.Foo }
%struct.Foo = type { i8 }
-; Function Attrs: mustprogress noinline nounwind optnone uwtable
+; Function Attrs: noinline nounwind optnone uwtable
define dso_local void @_Z7fooFuncv() #0 !dbg !10 {
entry:
%global2 = alloca %struct.Foo2, align 1
@@ -40,7 +40,7 @@ entry:
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-attributes #0 = { mustprogress noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.dbg.cu = !{!0}
diff --git a/clang/test/CodeGen/fp-floatcontrol-stack.cpp b/clang/test/CodeGen/fp-floatcontrol-stack.cpp
index 090da25d21207d..d8bff72ac13037 100644
--- a/clang/test/CodeGen/fp-floatcontrol-stack.cpp
+++ b/clang/test/CodeGen/fp-floatcontrol-stack.cpp
@@ -6,10 +6,10 @@
#define FUN(n) \
(float z) { return n * z + n; }
-// CHECK-DDEFAULT: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
-// CHECK-DEBSTRICT: Function Attrs: mustprogress noinline nounwind optnone strictfp{{$$}}
-// CHECK-FAST: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
-// CHECK-NOHONOR: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+// CHECK-DDEFAULT: Function Attrs: noinline nounwind optnone{{$$}}
+// CHECK-DEBSTRICT: Function Attrs: noinline nounwind optnone strictfp{{$$}}
+// CHECK-FAST: Function Attrs: noinline nounwind optnone{{$$}}
+// CHECK-NOHONOR: Function Attrs: noinline nounwind optnone{{$$}}
float fun_default FUN(1)
//CHECK-LABEL: define {{.*}} @_Z11fun_defaultf{{.*}}
#if DEFAULT
@@ -32,10 +32,10 @@ float fun_default FUN(1)
// Rule: precise must be enabled
#pragma float_control(except, on)
#endif
- // CHECK-FAST: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
- // CHECK-DDEFAULT: Function Attrs: mustprogress noinline nounwind optnone strictfp{{$$}}
- // CHECK-DEBSTRICT: Function Attrs: mustprogress noinline nounwind optnone strictfp{{$$}}
- // CHECK-NOHONOR: Function Attrs: mustprogress noinline nounwind optnone strictfp{{$$}}
+ // CHECK-FAST: Function Attrs: noinline nounwind optnone{{$$}}
+ // CHECK-DDEFAULT: Function Attrs: noinline nounwind optnone strictfp{{$$}}
+ // CHECK-DEBSTRICT: Function Attrs: noinline nounwind optnone strictfp{{$$}}
+ // CHECK-NOHONOR: Function Attrs: noinline nounwind optnone strictfp{{$$}}
float exc_on FUN(2)
//CHECK-LABEL: define {{.*}} @_Z6exc_onf{{.*}}
#if DEFAULT
@@ -54,10 +54,10 @@ float fun_default FUN(1)
#endif
#pragma float_control(pop)
- // CHECK-DDEFAULT: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
- // CHECK-DEBSTRICT: Function Attrs: mustprogress noinline nounwind optnone strictfp{{$$}}
- // CHECK-FAST: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
- // CHECK-NOHONOR: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+ // CHECK-DDEFAULT: Function Attrs: noinline nounwind optnone{{$$}}
+ // CHECK-DEBSTRICT: Function Attrs: noinline nounwind optnone strictfp{{$$}}
+ // CHECK-FAST: Function Attrs: noinline nounwind optnone{{$$}}
+ // CHECK-NOHONOR: Function Attrs: noinline nounwind optnone{{$$}}
float exc_pop FUN(5)
//CHECK-LABEL: define {{.*}} @_Z7exc_popf{{.*}}
#if DEFAULT
@@ -223,10 +223,10 @@ float fun_default FUN(1)
#pragma float_control(except, on)
#endif
float y();
-// CHECK-DDEFAULT: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
-// CHECK-DEBSTRICT: Function Attrs: mustprogress noinline nounwind optnone strictfp{{$$}}
-// CHECK-FAST: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
-// CHECK-NOHONOR: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+// CHECK-DDEFAULT: Function Attrs: noinline nounwind optnone{{$$}}
+// CHECK-DEBSTRICT: Function Attrs: noinline nounwind optnone strictfp{{$$}}
+// CHECK-FAST: Function Attrs: noinline nounwind optnone{{$$}}
+// CHECK-NOHONOR: Function Attrs: noinline nounwind optnone{{$$}}
class ON {
// Settings for top level class initializer use program source setting.
float z = 2 + y() * 7;
@@ -246,10 +246,10 @@ class ON {
};
ON on;
#pragma float_control(except, off)
-// CHECK-DDEFAULT: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
-// CHECK-DEBSTRICT: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
-// CHECK-FAST: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
-// CHECK-NOHONOR: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+// CHECK-DDEFAULT: Function Attrs: noinline nounwind optnone{{$$}}
+// CHECK-DEBSTRICT: Function Attrs: noinline nounwind optnone{{$$}}
+// CHECK-FAST: Function Attrs: noinline nounwind optnone{{$$}}
+// CHECK-NOHONOR: Function Attrs: noinline nounwind optnone{{$$}}
class OFF {
float w = 2 + y() * 7;
// CHECK-LABEL: define {{.*}} void @_ZN3OFFC2Ev{{.*}}
diff --git a/clang/test/CodeGen/sanitize-thread-attr.cpp b/clang/test/CodeGen/sanitize-thread-attr.cpp
index 15ae3a16df696a..ef861dfe8e42b0 100644
--- a/clang/test/CodeGen/sanitize-thread-attr.cpp
+++ b/clang/test/CodeGen/sanitize-thread-attr.cpp
@@ -58,5 +58,5 @@ int global2 = *(int*)((char*)&global1+1);
// BL: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
-// TSAN: attributes [[NOATTR]] = { mustprogress noinline nounwind{{.*}} }
+// TSAN: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
// TSAN: attributes [[WITH]] = { noinline nounwind sanitize_thread{{.*}} }
diff --git a/clang/test/CodeGenCXX/apple-kext.cpp b/clang/test/CodeGenCXX/apple-kext.cpp
index 2cba0be7a006af..d49ef2a0ccfa1b 100644
--- a/clang/test/CodeGenCXX/apple-kext.cpp
+++ b/clang/test/CodeGenCXX/apple-kext.cpp
@@ -38,5 +38,5 @@ namespace test0 {
// CHECK: call void @_ZN5test01AD1Ev(ptr @_ZN5test01aE)
// CHECK-NEXT: ret void
-// CHECK: attributes #[[ATTR0]] = { alwaysinline mustprogress nounwind {{.*}} }
-// CHECK: attributes #[[ATTR1]] = { mustprogress noinline nounwind {{.*}} }
+// CHECK: attributes #[[ATTR0]] = { alwaysinline nounwind {{.*}} }
+// CHECK: attributes #[[ATTR1]] = { noinline nounwind {{.*}} }
diff --git a/clang/test/CodeGenCXX/attr-mustprogress.cpp b/clang/test/CodeGenCXX/attr-mustprogress.cpp
index 5a24e9426d1308..6179712f285404 100644
--- a/clang/test/CodeGenCXX/attr-mustprogress.cpp
+++ b/clang/test/CodeGenCXX/attr-mustprogress.cpp
@@ -6,10 +6,10 @@
// Check -ffinite-loops option in combination with various standard versions.
// RUN: %clang_cc1 -std=c++98 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=FINITE %s
-// RUN: %clang_cc1 -std=c++11 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s
-// RUN: %clang_cc1 -std=c++14 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s
-// RUN: %clang_cc1 -std=c++17 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s
-// RUN: %clang_cc1 -std=c++20 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s
+// RUN: %clang_cc1 -std=c++11 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=FINITE %s
+// RUN: %clang_cc1 -std=c++14 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=FINITE %s
+// RUN: %clang_cc1 -std=c++17 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=FINITE %s
+// RUN: %clang_cc1 -std=c++20 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=FINITE %s
// Check -fno-finite-loops option in combination with various standard versions.
// RUN: %clang_cc1 -std=c++98 -fno-finite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX98 %s
@@ -23,9 +23,6 @@ int b = 0;
// CHECK: datalayout
-// CXX98-NOT: mustprogress
-// CXX11-NOT: mustprogress
-// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2f0v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %for.cond
@@ -37,9 +34,6 @@ void f0() {
for (; ;) ;
}
-// CXX98-NOT: mustprogress
-// CXX11-NOT: mustprogress
-// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2f1v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %for.cond
@@ -57,9 +51,6 @@ void f1() {
;
}
-// CXX98-NOT: mustprogress
-// CXX11: mustprogress
-// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2f2v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %for.cond
@@ -80,9 +71,6 @@ void f2() {
;
}
-// CXX98-NOT: mustprogress
-// CXX11-NOT: mustprogress
-// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z1Fv(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %for.cond
@@ -113,9 +101,6 @@ void F() {
;
}
-// CXX98-NOT: mustprogress
-// CXX11-NOT: mustprogress
-// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2F2v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %for.cond
@@ -146,9 +131,6 @@ void F2() {
;
}
-// CXX98-NOT: mustprogress
-// CXX11-NOT: mustprogress
-// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2w1v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %while.body
@@ -162,9 +144,6 @@ void w1() {
;
}
-// CXX98-NOT: mustprogress
-// CXX11: mustprogress
-// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2w2v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %while.cond
@@ -185,9 +164,6 @@ void w2() {
;
}
-// CXX98-NOT: mustprogress
-// CXX11-NOT: mustprogress
-// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z1Wv(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %while.cond
@@ -214,9 +190,6 @@ void W() {
;
}
-// CXX98-NOT: mustprogress
-// CXX11-NOT: mustprogress
-// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2W2v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %while.body
@@ -232,9 +205,6 @@ void W2() {
;
}
-// CXX98-NOT: mustprogress
-// CXX11-NOT: mustprogress
-// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2d1v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %do.body
@@ -253,9 +223,6 @@ void d1() {
while (1);
}
-// CXX98-NOT: mustprogress
-// CXX11: mustprogress
-// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2d2v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %do.body
@@ -277,9 +244,6 @@ void d2() {
while (a == b);
}
-// CXX98-NOT: mustprogress
-// CXX11-NOT: mustprogress
-// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z1Dv(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %do.body
@@ -312,9 +276,6 @@ void D() {
while (a == b);
}
-// CXX98-NOT: mustprogress
-// CXX11-NOT: mustprogress
-// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2D2v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %do.body
diff --git a/clang/test/CodeGenCXX/attr-target-clones-aarch64.cpp b/clang/test/CodeGenCXX/attr-target-clones-aarch64.cpp
index 7953f902bf09b2..c15f46cde54bfc 100644
--- a/clang/test/CodeGenCXX/attr-target-clones-aarch64.cpp
+++ b/clang/test/CodeGenCXX/attr-target-clones-aarch64.cpp
@@ -230,11 +230,11 @@ void run_foo_tml() {
// CHECK-NEXT: ret i32 2
//
//.
-// CHECK: attributes #[[ATTR0:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon" }
-// CHECK: attributes #[[ATTR1:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+ls64" }
-// CHECK: attributes #[[ATTR2:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
-// CHECK: attributes #[[ATTR3:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fptoint" }
-// CHECK: attributes #[[ATTR4:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme,+sme-f64f64" }
+// CHECK: attributes #[[ATTR0:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon" }
+// CHECK: attributes #[[ATTR1:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+ls64" }
+// CHECK: attributes #[[ATTR2:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// CHECK: attributes #[[ATTR3:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fptoint" }
+// CHECK: attributes #[[ATTR4:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme,+sme-f64f64" }
//.
// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
// CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
diff --git a/clang/test/CodeGenCXX/attr-target-version.cpp b/clang/test/CodeGenCXX/attr-target-version.cpp
index 8b7273fe3bb517..c9a22372f26f86 100644
--- a/clang/test/CodeGenCXX/attr-target-version.cpp
+++ b/clang/test/CodeGenCXX/attr-target-version.cpp
@@ -312,17 +312,17 @@ int bar() {
// CHECK-NEXT: ret ptr @_ZN7MyClass40unused_with_implicit_forward_default_defEv.default
//
//.
-// CHECK: attributes #[[ATTR0:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme,+sme-f64f64" }
-// CHECK: attributes #[[ATTR1:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
-// CHECK: attributes #[[ATTR2:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+fp-armv8,+neon,+sm4" }
-// CHECK: attributes #[[ATTR3:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc" }
-// CHECK: attributes #[[ATTR4:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+dotprod,+fp-armv8,+neon" }
-// CHECK: attributes #[[ATTR5:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+mops" }
-// CHECK: attributes #[[ATTR6:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon" }
-// CHECK: attributes #[[ATTR7:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sve" }
-// CHECK: attributes #[[ATTR8:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon" }
-// CHECK: attributes #[[ATTR9:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+lse" }
-// CHECK: attributes #[[ATTR10:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon,+rdm" }
+// CHECK: attributes #[[ATTR0:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme,+sme-f64f64" }
+// CHECK: attributes #[[ATTR1:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// CHECK: attributes #[[ATTR2:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+fp-armv8,+neon,+sm4" }
+// CHECK: attributes #[[ATTR3:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc" }
+// CHECK: attributes #[[ATTR4:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+dotprod,+fp-armv8,+neon" }
+// CHECK: attributes #[[ATTR5:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+mops" }
+// CHECK: attributes #[[ATTR6:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon" }
+// CHECK: attributes #[[ATTR7:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sve" }
+// CHECK: attributes #[[ATTR8:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon" }
+// CHECK: attributes #[[ATTR9:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+lse" }
+// CHECK: attributes #[[ATTR10:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon,+rdm" }
// CHECK: attributes #[[ATTR11:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
//.
// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
diff --git a/clang/test/CodeGenCXX/cxx11-exception-spec.cpp b/clang/test/CodeGenCXX/cxx11-exception-spec.cpp
index 08de8868b47100..3991c5170d14fc 100644
--- a/clang/test/CodeGenCXX/cxx11-exception-spec.cpp
+++ b/clang/test/CodeGenCXX/cxx11-exception-spec.cpp
@@ -121,7 +121,7 @@ void j() {
}
// CHECK: attributes [[NONE]] = { {{.*}} }
-// CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
// CHECK: attributes [[NUW2]] = { nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/cxx11-noreturn.cpp b/clang/test/CodeGenCXX/cxx11-noreturn.cpp
index feea72ef3f4503..58a5a377133a59 100644
--- a/clang/test/CodeGenCXX/cxx11-noreturn.cpp
+++ b/clang/test/CodeGenCXX/cxx11-noreturn.cpp
@@ -7,4 +7,4 @@ int g();
while (g()) {}
}
-// CHECK: attributes [[NR]] = { mustprogress noinline noreturn nounwind{{.*}} }
+// CHECK: attributes [[NR]] = { noinline noreturn nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/derived-to-base.cpp b/clang/test/CodeGenCXX/derived-to-base.cpp
index c8dbd5bf5cb05c..8b49d56a68d44f 100644
--- a/clang/test/CodeGenCXX/derived-to-base.cpp
+++ b/clang/test/CodeGenCXX/derived-to-base.cpp
@@ -46,4 +46,4 @@ namespace test3 {
}
}
-// CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/main-norecurse.cpp b/clang/test/CodeGenCXX/main-norecurse.cpp
index 3a476e6a119a25..a98677ce6f5999 100644
--- a/clang/test/CodeGenCXX/main-norecurse.cpp
+++ b/clang/test/CodeGenCXX/main-norecurse.cpp
@@ -5,4 +5,4 @@ int main(int argc, char **argv) {
return 1;
}
-// CHECK: attributes #0 = { mustprogress noinline norecurse{{.*}} }
+// CHECK: attributes #0 = { noinline norecurse{{.*}} }
diff --git a/clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp b/clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
index 1cc0e9af571c3a..d60b4fefbf688e 100644
--- a/clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
+++ b/clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
@@ -62,4 +62,4 @@ struct S {
void delete_s(S *s) { delete[] s; }
}
-// CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/no-exceptions.cpp b/clang/test/CodeGenCXX/no-exceptions.cpp
index 47f491e50e8f12..c951b685a8a1bf 100644
--- a/clang/test/CodeGenCXX/no-exceptions.cpp
+++ b/clang/test/CodeGenCXX/no-exceptions.cpp
@@ -3,7 +3,7 @@
void g();
// CHECK: define{{.*}} void @_Z1fv() [[NUW:#[0-9]+]]
-void f() throw (int) {
+void f() throw (int) {
// CHECK-NOT: invoke void @_Z1gv
g();
@@ -11,4 +11,4 @@ void f() throw (int) {
// CHECK: ret void
}
-// CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/noinline-template.cpp b/clang/test/CodeGenCXX/noinline-template.cpp
index cb81f72d0714f3..507ca3f34af51f 100644
--- a/clang/test/CodeGenCXX/noinline-template.cpp
+++ b/clang/test/CodeGenCXX/noinline-template.cpp
@@ -15,4 +15,4 @@ void foo() {
strs.growStorageBy();
}
-// CHECK: attributes [[NI]] = { mustprogress noinline nounwind{{.*}} }
+// CHECK: attributes [[NI]] = { noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/optnone-and-attributes.cpp b/clang/test/CodeGenCXX/optnone-and-attributes.cpp
index 68aa0988b18b59..870d5e9496f04e 100644
--- a/clang/test/CodeGenCXX/optnone-and-attributes.cpp
+++ b/clang/test/CodeGenCXX/optnone-and-attributes.cpp
@@ -75,8 +75,8 @@ int exported_optnone_func(int a) {
// CHECK: declare dllimport {{.*}} @_Z21imported_optnone_funci({{.*}}) [[DLLIMPORT:#[0-9]+]]
-// CHECK: attributes [[OPTNONE]] = { mustprogress noinline {{.*}} optnone
-// CHECK: attributes [[NORETURN]] = { mustprogress noinline noreturn {{.*}} optnone
+// CHECK: attributes [[OPTNONE]] = { noinline {{.*}} optnone
+// CHECK: attributes [[NORETURN]] = { noinline noreturn {{.*}} optnone
// CHECK: attributes [[DLLIMPORT]] =
// CHECK-NOT: optnone
diff --git a/clang/test/CodeGenCXX/optnone-def-decl.cpp b/clang/test/CodeGenCXX/optnone-def-decl.cpp
index 9e7d295ea31d47..6e4e510b9bf6ec 100644
--- a/clang/test/CodeGenCXX/optnone-def-decl.cpp
+++ b/clang/test/CodeGenCXX/optnone-def-decl.cpp
@@ -89,7 +89,7 @@ int user_of_forceinline_optnone_function() {
// CHECK: @_Z36user_of_forceinline_optnone_functionv() [[NORMAL]]
// CHECK: @_Z28forceinline_optnone_functionii({{.*}}) [[OPTNONE]]
-// CHECK: attributes [[OPTNONE]] = { mustprogress noinline nounwind optnone {{.*}} }
+// CHECK: attributes [[OPTNONE]] = { noinline nounwind optnone {{.*}} }
// CHECK: attributes [[NORMAL]] =
// CHECK-NOT: noinline
// CHECK-NOT: optnone
diff --git a/clang/test/CodeGenCXX/pr58798.cpp b/clang/test/CodeGenCXX/pr58798.cpp
index 607b36aa7f69a9..ced8823e571e73 100644
--- a/clang/test/CodeGenCXX/pr58798.cpp
+++ b/clang/test/CodeGenCXX/pr58798.cpp
@@ -1,7 +1,7 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --check-attributes
// RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-linux-gnu -fexceptions -fcxx-exceptions | FileCheck %s
-// CHECK: Function Attrs: mustprogress noinline nounwind optnone willreturn memory(read)
+// CHECK: Function Attrs: noinline nounwind optnone willreturn memory(read)
// CHECK-LABEL: define {{[^@]+}}@_Z54early_caller_of_callee_with_clang_attr_with_clang_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR0:[0-9]+]] {
// CHECK-NEXT: entry:
@@ -12,7 +12,7 @@
// CHECK-NEXT: ret i32 [[CALL]]
//
-// CHECK: Function Attrs: mustprogress noinline nounwind optnone willreturn memory(read)
+// CHECK: Function Attrs: noinline nounwind optnone willreturn memory(read)
// CHECK-LABEL: define {{[^@]+}}@_Z22callee_with_clang_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR0]] {
// CHECK-NEXT: entry:
@@ -30,7 +30,7 @@
// CHECK-NEXT: ret i32 24
//
-// CHECK: Function Attrs: mustprogress noinline nounwind optnone
+// CHECK: Function Attrs: noinline nounwind optnone
// CHECK-LABEL: define {{[^@]+}}@_Z52early_caller_of_callee_with_clang_attr_with_cxx_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR1:[0-9]+]] {
// CHECK-NEXT: entry:
@@ -41,7 +41,7 @@
// CHECK-NEXT: ret i32 [[CALL]]
//
-// CHECK: Function Attrs: mustprogress noinline nounwind optnone willreturn memory(read)
+// CHECK: Function Attrs: noinline nounwind optnone willreturn memory(read)
// CHECK-LABEL: define {{[^@]+}}@_Z52early_caller_of_callee_with_cxx_attr_with_clang_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR0]] {
// CHECK-NEXT: entry:
@@ -52,7 +52,7 @@
// CHECK-NEXT: ret i32 [[CALL]]
//
-// CHECK: Function Attrs: mustprogress noinline nounwind optnone
+// CHECK: Function Attrs: noinline nounwind optnone
// CHECK-LABEL: define {{[^@]+}}@_Z20callee_with_cxx_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR1]] personality ptr @__gxx_personality_v0 {
// CHECK-NEXT: entry:
@@ -78,7 +78,7 @@
// CHECK-NEXT: unreachable
//
-// CHECK: Function Attrs: mustprogress noinline nounwind optnone
+// CHECK: Function Attrs: noinline nounwind optnone
// CHECK-LABEL: define {{[^@]+}}@_Z50early_caller_of_callee_with_cxx_attr_with_cxx_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR1]] {
// CHECK-NEXT: entry:
@@ -129,7 +129,7 @@ int callee_with_cxx_attr(int a) noexcept {
// Calls to definitions:
-// CHECK: Function Attrs: mustprogress noinline nounwind optnone willreturn memory(read)
+// CHECK: Function Attrs: noinline nounwind optnone willreturn memory(read)
// CHECK-LABEL: define {{[^@]+}}@_Z53late_caller_of_callee_with_clang_attr_with_clang_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR0]] {
// CHECK-NEXT: entry:
@@ -143,7 +143,7 @@ __attribute__((pure)) int late_caller_of_callee_with_clang_attr_with_clang_attr(
return callee_with_clang_attr(a);
}
-// CHECK: Function Attrs: mustprogress noinline nounwind optnone
+// CHECK: Function Attrs: noinline nounwind optnone
// CHECK-LABEL: define {{[^@]+}}@_Z51late_caller_of_callee_with_clang_attr_with_cxx_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR1]] {
// CHECK-NEXT: entry:
@@ -157,7 +157,7 @@ int late_caller_of_callee_with_clang_attr_with_cxx_attr(int a) noexcept {
return callee_with_clang_attr(a);
}
-// CHECK: Function Attrs: mustprogress noinline nounwind optnone willreturn memory(read)
+// CHECK: Function Attrs: noinline nounwind optnone willreturn memory(read)
// CHECK-LABEL: define {{[^@]+}}@_Z51late_caller_of_callee_with_cxx_attr_with_clang_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR0]] {
// CHECK-NEXT: entry:
@@ -171,7 +171,7 @@ __attribute__((pure)) int late_caller_of_callee_with_cxx_attr_with_clang_attr(in
return callee_with_cxx_attr(a);
}
-// CHECK: Function Attrs: mustprogress noinline nounwind optnone
+// CHECK: Function Attrs: noinline nounwind optnone
// CHECK-LABEL: define {{[^@]+}}@_Z49late_caller_of_callee_with_cxx_attr_with_cxx_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR1]] {
// CHECK-NEXT: entry:
diff --git a/clang/test/CodeGenCXX/reference-cast.cpp b/clang/test/CodeGenCXX/reference-cast.cpp
index e7b07365974d6f..5cb0901c4b9ccb 100644
--- a/clang/test/CodeGenCXX/reference-cast.cpp
+++ b/clang/test/CodeGenCXX/reference-cast.cpp
@@ -15,7 +15,7 @@ const int &lvalue_noop_cast() {
return 17;
}
-// CHECK-LABEL: define{{.*}} nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) ptr @_Z20lvalue_integral_castv()
+// CHECK-LABEL: define{{.*}} nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) ptr @_Z20lvalue_integral_castv()
const short &lvalue_integral_cast() {
if (i == 0)
// CHECK: store i16 17, ptr
@@ -193,4 +193,4 @@ namespace PR10650 {
// CHECK: store i64
}
-// CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/threadsafe-statics.cpp b/clang/test/CodeGenCXX/threadsafe-statics.cpp
index 4c53482d4c4c9b..443fbecc3d260a 100644
--- a/clang/test/CodeGenCXX/threadsafe-statics.cpp
+++ b/clang/test/CodeGenCXX/threadsafe-statics.cpp
@@ -22,6 +22,6 @@ void g() {
// NO-TSS-NOT: call void @__cxa_guard_release
// NO-TSS: ret void
-// WITH-TSS: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
+// WITH-TSS: attributes [[NUW]] = { noinline nounwind{{.*}} }
-// NO-TSS: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
+// NO-TSS: attributes [[NUW]] = { noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/thunks-ehspec.cpp b/clang/test/CodeGenCXX/thunks-ehspec.cpp
index 4c95a471114080..813d9a62724475 100644
--- a/clang/test/CodeGenCXX/thunks-ehspec.cpp
+++ b/clang/test/CodeGenCXX/thunks-ehspec.cpp
@@ -17,13 +17,13 @@ class C : A, B {
};
void C::primary_key() {}
-// CHECK-LABEL: define available_externally void @_ZThn8_N1C9secondaryEv(ptr noundef %this) {{.*}} #2
+// CHECK-LABEL: define available_externally void @_ZThn8_N1C9secondaryEv(ptr noundef %this) {{.*}} #0
// CHECK-NOT: invoke
// CHECK: tail call void @_ZN1C9secondaryEv(ptr {{[^,]*}} %{{.*}})
// CHECK-NOT: invoke
// CHECK: ret void
-// CHECK-LABEL: define available_externally void @_ZThn8_N1C16secondary_varargEiz(ptr noundef %this, i32 noundef %0, ...) {{.*}} #2
+// CHECK-LABEL: define available_externally void @_ZThn8_N1C16secondary_varargEiz(ptr noundef %this, i32 noundef %0, ...) {{.*}} #0
// CHECK-NOT: invoke
-// CHECK: musttail call void (ptr, i32, ...) @_ZN1C16secondary_varargEiz(ptr {{[^,]*}} %{{.*}}, i32 noundef %{{.*}}, ...) #3
+// CHECK: musttail call void (ptr, i32, ...) @_ZN1C16secondary_varargEiz(ptr {{[^,]*}} %{{.*}}, i32 noundef %{{.*}}, ...) #2
// CHECK-NEXT: ret void
diff --git a/clang/test/CodeGenCXX/thunks.cpp b/clang/test/CodeGenCXX/thunks.cpp
index f1ceebf24ba189..394dc8d7665153 100644
--- a/clang/test/CodeGenCXX/thunks.cpp
+++ b/clang/test/CodeGenCXX/thunks.cpp
@@ -529,7 +529,7 @@ C c;
// CHECK-NONOPT-LABEL: define linkonce_odr void @_ZThn8_N6Test101C3fooEv
// Checking with opt
-// CHECK-OPT-LABEL: define internal void @_ZThn8_N6Test4B12_GLOBAL__N_11C1fEv(ptr noundef %this) unnamed_addr #1 align 2
+// CHECK-OPT-LABEL: define internal void @_ZThn8_N6Test4B12_GLOBAL__N_11C1fEv(ptr noundef %this) unnamed_addr #0 align 2
// This is from Test5:
// CHECK-OPT-LABEL: define linkonce_odr void @_ZTv0_n24_N5Test51B1fEv
diff --git a/clang/test/CodeGenCXX/virtual-base-cast.cpp b/clang/test/CodeGenCXX/virtual-base-cast.cpp
index 57388431e90076..a6b4672eddc835 100644
--- a/clang/test/CodeGenCXX/virtual-base-cast.cpp
+++ b/clang/test/CodeGenCXX/virtual-base-cast.cpp
@@ -75,4 +75,4 @@ BB* d() { return y; }
// MSVC: add nsw i32 4, %[[offset]]
// MSVC: }
-// CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenHIP/default-attributes.hip b/clang/test/CodeGenHIP/default-attributes.hip
index 63572bfd242b98..e1e1f4417fa438 100644
--- a/clang/test/CodeGenHIP/default-attributes.hip
+++ b/clang/test/CodeGenHIP/default-attributes.hip
@@ -8,7 +8,7 @@
#define __device__ __attribute__((device))
#define __global__ __attribute__((global))
-// OPTNONE: Function Attrs: convergent mustprogress noinline nounwind optnone
+// OPTNONE: Function Attrs: convergent noinline nounwind optnone
// OPTNONE-LABEL: define {{[^@]+}}@_Z4funcv
// OPTNONE-SAME: () #[[ATTR0:[0-9]+]] {
// OPTNONE-NEXT: entry:
@@ -24,7 +24,7 @@ __device__ void func() {
}
-// OPTNONE: Function Attrs: convergent mustprogress noinline norecurse nounwind optnone
+// OPTNONE: Function Attrs: convergent noinline norecurse nounwind optnone
// OPTNONE-LABEL: define {{[^@]+}}@_Z6kernelv
// OPTNONE-SAME: () #[[ATTR1:[0-9]+]] {
// OPTNONE-NEXT: entry:
@@ -40,8 +40,8 @@ __global__ void kernel() {
}
//.
-// OPTNONE: attributes #0 = { convergent mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
-// OPTNONE: attributes #1 = { convergent mustprogress noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,1024" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
+// OPTNONE: attributes #0 = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// OPTNONE: attributes #1 = { convergent noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,1024" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
//.
// OPT: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
// OPT: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) "amdgpu-flat-work-group-size"="1,1024" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
diff --git a/clang/test/CodeGenObjCXX/lambda-expressions.mm b/clang/test/CodeGenObjCXX/lambda-expressions.mm
index e1fb6ec709b727..1afbde04ab0fa5 100644
--- a/clang/test/CodeGenObjCXX/lambda-expressions.mm
+++ b/clang/test/CodeGenObjCXX/lambda-expressions.mm
@@ -163,5 +163,5 @@ void test() {
#endif
-// ARC: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
-// MRC: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
+// ARC: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// MRC: attributes [[NUW]] = { noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenSYCL/function-attrs.cpp b/clang/test/CodeGenSYCL/function-attrs.cpp
index 1606f961f2d391..21bef5b4a961d5 100644
--- a/clang/test/CodeGenSYCL/function-attrs.cpp
+++ b/clang/test/CodeGenSYCL/function-attrs.cpp
@@ -49,7 +49,7 @@ int main() {
return 0;
}
//.
-// CHECK: attributes #0 = { convergent mustprogress noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// CHECK: attributes #0 = { convergent noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
// CHECK: attributes #1 = { convergent nounwind }
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
diff --git a/clang/test/Modules/aarch64-sme-keywords.cppm b/clang/test/Modules/aarch64-sme-keywords.cppm
index 759701a633cebe..4852d7e10d602f 100644
--- a/clang/test/Modules/aarch64-sme-keywords.cppm
+++ b/clang/test/Modules/aarch64-sme-keywords.cppm
@@ -31,7 +31,7 @@ import A;
//
// CHECK:declare void @_ZW1A14f_preserves_zav() #[[PRESERVES_ZA_DECL:[0-9]+]]
//
-// CHECK:; Function Attrs: mustprogress noinline nounwind optnone
+// CHECK:; Function Attrs: noinline nounwind optnone
// CHECK:define dso_local void @_Z21f_nonstreaming_callerv() #[[NORMAL_DEF:[0-9]+]] {
// CHECK:entry:
// CHECK: call void @_ZW1A11f_streamingv() #[[STREAMING_USE:[0-9]+]]
diff --git a/clang/test/OpenMP/amdgcn-attributes.cpp b/clang/test/OpenMP/amdgcn-attributes.cpp
index 5ddc34537d12fb..fd6497919e3b70 100644
--- a/clang/test/OpenMP/amdgcn-attributes.cpp
+++ b/clang/test/OpenMP/amdgcn-attributes.cpp
@@ -32,12 +32,12 @@ int callable(int x) {
return x + 1;
}
-// DEFAULT: attributes #0 = { convergent mustprogress noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "kernel" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
-// CPU: attributes #0 = { convergent mustprogress noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "kernel" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" "uniform-work-group-size"="true" }
-// NOIEEE: attributes #0 = { convergent mustprogress noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "amdgpu-ieee"="false" "kernel" "no-nans-fp-math"="true" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
-// UNSAFEATOMIC: attributes #0 = { convergent mustprogress noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "amdgpu-unsafe-fp-atomics"="true" "kernel" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
-
-// DEFAULT: attributes #2 = { convergent mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
-// CPU: attributes #2 = { convergent mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" }
-// NOIEEE: attributes #2 = { convergent mustprogress noinline nounwind optnone "amdgpu-ieee"="false" "no-nans-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
-// UNSAFEATOMIC: attributes #2 = { convergent mustprogress noinline nounwind optnone "amdgpu-unsafe-fp-atomics"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// DEFAULT: attributes #0 = { convergent noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "kernel" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
+// CPU: attributes #0 = { convergent noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "kernel" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" "uniform-work-group-size"="true" }
+// NOIEEE: attributes #0 = { convergent noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "amdgpu-ieee"="false" "kernel" "no-nans-fp-math"="true" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
+// UNSAFEATOMIC: attributes #0 = { convergent noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "amdgpu-unsafe-fp-atomics"="true" "kernel" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
+
+// DEFAULT: attributes #2 = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// CPU: attributes #2 = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" }
+// NOIEEE: attributes #2 = { convergent noinline nounwind optnone "amdgpu-ieee"="false" "no-nans-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// UNSAFEATOMIC: attributes #2 = { convergent noinline nounwind optnone "amdgpu-unsafe-fp-atomics"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
diff --git a/clang/test/OpenMP/irbuilder_safelen.cpp b/clang/test/OpenMP/irbuilder_safelen.cpp
index 4ce9e3918957ae..84a7d9fe2aeed5 100644
--- a/clang/test/OpenMP/irbuilder_safelen.cpp
+++ b/clang/test/OpenMP/irbuilder_safelen.cpp
@@ -244,8 +244,7 @@ void simple(float *a, float *b, int *c) {
// CHECK-NEXT: ret void
//
//.
-// CHECK: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
-// CHECK: attributes #1 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #0 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
// CHECK: !1 = !{i32 7, !"openmp", i32 45}
diff --git a/clang/test/OpenMP/irbuilder_safelen_order_concurrent.cpp b/clang/test/OpenMP/irbuilder_safelen_order_concurrent.cpp
index f82a7b229356cb..5d3c8f240963da 100644
--- a/clang/test/OpenMP/irbuilder_safelen_order_concurrent.cpp
+++ b/clang/test/OpenMP/irbuilder_safelen_order_concurrent.cpp
@@ -244,8 +244,7 @@ void simple(float *a, float *b, int *c) {
// CHECK-NEXT: ret void
//
//.
-// CHECK: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
-// CHECK: attributes #1 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #0 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
// CHECK: !1 = !{i32 7, !"openmp", i32 50}
diff --git a/clang/test/OpenMP/irbuilder_simd_aligned.cpp b/clang/test/OpenMP/irbuilder_simd_aligned.cpp
index db8f19cd56b14e..fa35946de3b474 100644
--- a/clang/test/OpenMP/irbuilder_simd_aligned.cpp
+++ b/clang/test/OpenMP/irbuilder_simd_aligned.cpp
@@ -282,9 +282,8 @@ void simple(float *a, float *b, int *c) {
// CHECK-NEXT: ret void
//
//.
-// CHECK: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
-// CHECK: attributes #1 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
-// CHECK: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
+// CHECK: attributes #0 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
// CHECK: !1 = !{i32 7, !"openmp", i32 50}
diff --git a/clang/test/OpenMP/irbuilder_simdlen.cpp b/clang/test/OpenMP/irbuilder_simdlen.cpp
index 99261faff383df..7a081542cda8b7 100644
--- a/clang/test/OpenMP/irbuilder_simdlen.cpp
+++ b/clang/test/OpenMP/irbuilder_simdlen.cpp
@@ -244,8 +244,7 @@ void simple(float *a, float *b, int *c) {
// CHECK-NEXT: ret void
//
//.
-// CHECK: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
-// CHECK: attributes #1 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #0 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
// CHECK: !1 = !{i32 7, !"openmp", i32 45}
diff --git a/clang/test/OpenMP/irbuilder_simdlen_safelen.cpp b/clang/test/OpenMP/irbuilder_simdlen_safelen.cpp
index 13a1db4ced5ab3..44796c9f3f20fd 100644
--- a/clang/test/OpenMP/irbuilder_simdlen_safelen.cpp
+++ b/clang/test/OpenMP/irbuilder_simdlen_safelen.cpp
@@ -244,8 +244,7 @@ void simple(float *a, float *b, int *c) {
// CHECK-NEXT: ret void
//
//.
-// CHECK: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
-// CHECK: attributes #1 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #0 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
// CHECK: !1 = !{i32 7, !"openmp", i32 45}
diff --git a/clang/test/OpenMP/parallel_if_codegen_PR51349.cpp b/clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
index 1c6a56239204c3..120685011f70bb 100644
--- a/clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
+++ b/clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
@@ -14,7 +14,7 @@ void foo() {
}
#endif
-// CHECK: Function Attrs: mustprogress nounwind
+// CHECK: Function Attrs: nounwind
// CHECK-LABEL: define {{[^@]+}}@_Z3foov
// CHECK-SAME: () #[[ATTR0:[0-9]+]] {
// CHECK-NEXT: entry:
@@ -52,7 +52,7 @@ void foo() {
// CHECK-NEXT: ret void
//
//
-// CHECK-NOINLINE: Function Attrs: mustprogress noinline nounwind
+// CHECK-NOINLINE: Function Attrs: noinline nounwind
// CHECK-NOINLINE-LABEL: define {{[^@]+}}@_Z3foov
// CHECK-NOINLINE-SAME: () #[[ATTR0:[0-9]+]] {
// CHECK-NOINLINE-NEXT: entry:
diff --git a/clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected b/clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected
index dd9e33cf8a381f..b04e95944d999a 100644
--- a/clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected
+++ b/clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected
@@ -11,7 +11,7 @@ struct ST {
struct RT Z;
};
-// CHECK: Function Attrs: mustprogress noinline nounwind optnone
+// CHECK: Function Attrs: noinline nounwind optnone
// CHECK-LABEL: @_Z3fooP2ST(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[S_ADDR:%.*]] = alloca ptr, align 8
>From c7293a08e8679def67789029b9834c4c666dd57b Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Mon, 29 Apr 2024 14:57:37 +0200
Subject: [PATCH 3/8] Fix release notes
---
clang/docs/ReleaseNotes.rst | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index f5906c2dd4eb52..2174e20ee09e6e 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -122,8 +122,6 @@ C++23 Feature Support
materialize temporary object which is a prvalue in discarded-value expression.
- Implemented `P1774R8: Portable assumptions <https://wg21.link/P1774R8>`_.
-- Implemented `P2809R3: Trivial infinite loops are not Undefined Behavior <https://wg21.link/P2809R3>`_.
-
C++2c Feature Support
^^^^^^^^^^^^^^^^^^^^^
@@ -131,7 +129,7 @@ C++2c Feature Support
- Implemented `P2573R2: = delete("should have a reason"); <https://wg21.link/P2573R2>`_
-- Implemented `P2573R2: = delete("should have a reason"); <https://wg21.link/P2573R2>`_
+- Implemented `P2809R3: Trivial infinite loops are not Undefined Behavior <https://wg21.link/P2809R3>`_.
Resolutions to C++ Defect Reports
>From 2d9290bbe6aa2c05dd82e7be09cd39b8dbcbfee7 Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Mon, 29 Apr 2024 14:59:15 +0200
Subject: [PATCH 4/8] Address Erich's feedback
---
clang/lib/CodeGen/CGStmt.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index f37af32f120728..98c124deb9ce2e 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -927,7 +927,8 @@ bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression,
!ControllingExpression ||
(ControllingExpression->EvaluateAsInt(Result, getContext()) &&
Result.Val.isInt());
- bool IsTrue = CondIsConstInt &&
+
+ bool CondIsTrue = CondIsConstInt &&
(!ControllingExpression || Result.Val.getInt().getBoolValue());
if (getLangOpts().C99 && CondIsConstInt)
@@ -943,7 +944,7 @@ bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression,
// [...]
// - continue execution of a trivial infinite loop ([stmt.iter.general]).
if (getLangOpts().CPlusPlus11)
- return !(IsTrivialCXXLoop && IsTrue);
+ return !(IsTrivialCXXLoop && CondIsTrue);
return false;
}
>From 03232873d06bf165554124d8cb5183e30b78f2dd Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Mon, 29 Apr 2024 15:19:07 +0200
Subject: [PATCH 5/8] Fix release notes (take 2)
---
clang/docs/ReleaseNotes.rst | 2 ++
1 file changed, 2 insertions(+)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 2174e20ee09e6e..e5a2f9649be242 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -122,6 +122,8 @@ C++23 Feature Support
materialize temporary object which is a prvalue in discarded-value expression.
- Implemented `P1774R8: Portable assumptions <https://wg21.link/P1774R8>`_.
+- Implemented `P2448R2: Relaxing some constexpr restrictions <https://wg21.link/P2448R2>`_.
+
C++2c Feature Support
^^^^^^^^^^^^^^^^^^^^^
>From 7d8aa185d01d62205302731f4f018c6116c8f7e4 Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Mon, 29 Apr 2024 19:29:36 +0200
Subject: [PATCH 6/8] Revert "Remove the mustprogress attributes on functions."
This reverts commit 5671ea9763730f67d406c389ace104e17234f562.
---
clang/lib/CodeGen/CGStmt.cpp | 9 ++-
clang/lib/CodeGen/CodeGenFunction.cpp | 6 ++
clang/lib/CodeGen/CodeGenFunction.h | 18 +++++
clang/test/CXX/special/class.dtor/p3-0x.cpp | 2 +-
.../aarch64-sme-attrs.cpp | 14 ++--
.../CodeGen/address-safety-attr-flavors.cpp | 70 +++++++++----------
clang/test/CodeGen/address-safety-attr.cpp | 4 +-
.../debug-names-compound-type-units.ll | 4 +-
clang/test/CodeGen/fp-floatcontrol-stack.cpp | 40 +++++------
clang/test/CodeGen/sanitize-thread-attr.cpp | 2 +-
clang/test/CodeGenCXX/apple-kext.cpp | 4 +-
clang/test/CodeGenCXX/attr-mustprogress.cpp | 47 +++++++++++--
.../CodeGenCXX/attr-target-clones-aarch64.cpp | 10 +--
clang/test/CodeGenCXX/attr-target-version.cpp | 22 +++---
.../test/CodeGenCXX/cxx11-exception-spec.cpp | 2 +-
clang/test/CodeGenCXX/cxx11-noreturn.cpp | 2 +-
clang/test/CodeGenCXX/derived-to-base.cpp | 2 +-
clang/test/CodeGenCXX/main-norecurse.cpp | 2 +-
.../microsoft-abi-array-cookies.cpp | 2 +-
clang/test/CodeGenCXX/no-exceptions.cpp | 4 +-
clang/test/CodeGenCXX/noinline-template.cpp | 2 +-
.../CodeGenCXX/optnone-and-attributes.cpp | 4 +-
clang/test/CodeGenCXX/optnone-def-decl.cpp | 2 +-
clang/test/CodeGenCXX/pr58798.cpp | 20 +++---
clang/test/CodeGenCXX/reference-cast.cpp | 4 +-
clang/test/CodeGenCXX/threadsafe-statics.cpp | 4 +-
clang/test/CodeGenCXX/thunks-ehspec.cpp | 6 +-
clang/test/CodeGenCXX/thunks.cpp | 2 +-
clang/test/CodeGenCXX/virtual-base-cast.cpp | 2 +-
clang/test/CodeGenHIP/default-attributes.hip | 8 +--
.../test/CodeGenObjCXX/lambda-expressions.mm | 4 +-
clang/test/CodeGenSYCL/function-attrs.cpp | 2 +-
clang/test/Modules/aarch64-sme-keywords.cppm | 2 +-
clang/test/OpenMP/amdgcn-attributes.cpp | 18 ++---
clang/test/OpenMP/irbuilder_safelen.cpp | 3 +-
.../irbuilder_safelen_order_concurrent.cpp | 3 +-
clang/test/OpenMP/irbuilder_simd_aligned.cpp | 5 +-
clang/test/OpenMP/irbuilder_simdlen.cpp | 3 +-
.../test/OpenMP/irbuilder_simdlen_safelen.cpp | 3 +-
.../OpenMP/parallel_if_codegen_PR51349.cpp | 4 +-
.../check-attributes.cpp.funcattrs.expected | 2 +-
41 files changed, 221 insertions(+), 148 deletions(-)
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 98c124deb9ce2e..6aa6117c006352 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -943,8 +943,13 @@ bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression,
// following:
// [...]
// - continue execution of a trivial infinite loop ([stmt.iter.general]).
- if (getLangOpts().CPlusPlus11)
- return !(IsTrivialCXXLoop && CondIsTrue);
+ if (getLangOpts().CPlusPlus11) {
+ if (IsTrivialCXXLoop && CondIsTrue) {
+ CurFn->removeFnAttr(llvm::Attribute::MustProgress);
+ return false;
+ }
+ return true;
+ }
return false;
}
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 76262b6e0d2c84..95c0784ad9760c 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1463,6 +1463,12 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
if (Body && isa_and_nonnull<CoroutineBodyStmt>(Body))
llvm::append_range(FnArgs, FD->parameters());
+ // Ensure that the function adheres to the forward progress guarantee, which
+ // is required by certain optimizations.
+ // The attribute will be removed if the body contains a trivial empty loop.
+ if (checkIfFunctionMustProgress())
+ CurFn->addFnAttr(llvm::Attribute::MustProgress);
+
// Generate the body of the function.
PGO.assignRegionCounters(GD, CurFn);
if (isa<CXXDestructorDecl>(FD))
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index f8d160c52f5944..f0e8e47bc0e420 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -614,6 +614,24 @@ class CodeGenFunction : public CodeGenTypeCache {
// applies to. nullptr if there is no 'musttail' on the current statement.
const CallExpr *MustTailCall = nullptr;
+ /// Returns true if a function must make progress, which means the
+ /// mustprogress attribute can be added.
+ bool checkIfFunctionMustProgress() {
+ if (CGM.getCodeGenOpts().getFiniteLoops() ==
+ CodeGenOptions::FiniteLoopsKind::Never)
+ return false;
+
+ // C++11 and later guarantees that a thread eventually will do one of the
+ // following (C++11 [intro.multithread]p24 and C++17 [intro.progress]p1):
+ // - terminate,
+ // - make a call to a library I/O function,
+ // - perform an access through a volatile glvalue, or
+ // - perform a synchronization operation or an atomic operation.
+ //
+ // Hence each function is 'mustprogress' in C++11 or later.
+ return getLangOpts().CPlusPlus11;
+ }
+
/// Returns true if a loop must make progress, which means the mustprogress
/// attribute can be added. \p HasConstantCond indicates whether the branch
/// condition is a known constant.
diff --git a/clang/test/CXX/special/class.dtor/p3-0x.cpp b/clang/test/CXX/special/class.dtor/p3-0x.cpp
index f6a64260e0df53..857bdca557fdc4 100644
--- a/clang/test/CXX/special/class.dtor/p3-0x.cpp
+++ b/clang/test/CXX/special/class.dtor/p3-0x.cpp
@@ -176,4 +176,4 @@ struct TVC : VX
template <typename T>
TVC<T>::~TVC() {}
-// CHECK: attributes [[ATTRGRP]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[ATTRGRP]] = { mustprogress noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/aarch64-sme-attrs.cpp b/clang/test/CodeGen/aarch64-sme-intrinsics/aarch64-sme-attrs.cpp
index 8fb3b0cac7bb4c..fdd2de11365dd4 100644
--- a/clang/test/CodeGen/aarch64-sme-intrinsics/aarch64-sme-attrs.cpp
+++ b/clang/test/CodeGen/aarch64-sme-intrinsics/aarch64-sme-attrs.cpp
@@ -278,18 +278,18 @@ int test_variadic_template() __arm_inout("za") {
preserves_za_decl);
}
-// CHECK: attributes #[[SM_ENABLED]] = { noinline nounwind "aarch64_pstate_sm_enabled" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[SM_ENABLED]] = { mustprogress noinline nounwind "aarch64_pstate_sm_enabled" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
// CHECK: attributes #[[NORMAL_DECL]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
// CHECK: attributes #[[SM_ENABLED_DECL]] = { "aarch64_pstate_sm_enabled" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
-// CHECK: attributes #[[SM_COMPATIBLE]] = { noinline nounwind "aarch64_pstate_sm_compatible" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[SM_COMPATIBLE]] = { mustprogress noinline nounwind "aarch64_pstate_sm_compatible" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
// CHECK: attributes #[[SM_COMPATIBLE_DECL]] = { "aarch64_pstate_sm_compatible" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
-// CHECK: attributes #[[SM_BODY]] = { noinline nounwind "aarch64_pstate_sm_body" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
-// CHECK: attributes #[[ZA_SHARED]] = { noinline nounwind "aarch64_inout_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[SM_BODY]] = { mustprogress noinline nounwind "aarch64_pstate_sm_body" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[ZA_SHARED]] = { mustprogress noinline nounwind "aarch64_inout_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
// CHECK: attributes #[[ZA_SHARED_DECL]] = { "aarch64_inout_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
-// CHECK: attributes #[[ZA_PRESERVED]] = { noinline nounwind "aarch64_preserves_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[ZA_PRESERVED]] = { mustprogress noinline nounwind "aarch64_preserves_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
// CHECK: attributes #[[ZA_PRESERVED_DECL]] = { "aarch64_preserves_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
-// CHECK: attributes #[[ZA_NEW]] = { noinline nounwind "aarch64_new_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
-// CHECK: attributes #[[NORMAL_DEF]] = { noinline nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[ZA_NEW]] = { mustprogress noinline nounwind "aarch64_new_za" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
+// CHECK: attributes #[[NORMAL_DEF]] = { mustprogress noinline nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme" }
// CHECK: attributes #[[SM_ENABLED_CALL]] = { "aarch64_pstate_sm_enabled" }
// CHECK: attributes #[[SM_COMPATIBLE_CALL]] = { "aarch64_pstate_sm_compatible" }
// CHECK: attributes #[[SM_BODY_CALL]] = { "aarch64_pstate_sm_body" }
diff --git a/clang/test/CodeGen/address-safety-attr-flavors.cpp b/clang/test/CodeGen/address-safety-attr-flavors.cpp
index f14257e718c09b..ef815555059db8 100644
--- a/clang/test/CodeGen/address-safety-attr-flavors.cpp
+++ b/clang/test/CodeGen/address-safety-attr-flavors.cpp
@@ -25,60 +25,60 @@
// RUN: FileCheck -check-prefix=CHECK-KHWASAN %s
int HasSanitizeAddress() { return 1; }
-// CHECK-NOASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-ASAN: Function Attrs: noinline nounwind sanitize_address
-// CHECK-KASAN: Function Attrs: noinline nounwind sanitize_address
-// CHECK-HWASAN: Function Attrs: noinline nounwind sanitize_hwaddress
-// CHECK-KHWASAN: Function Attrs: noinline nounwind sanitize_hwaddress
+// CHECK-NOASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-ASAN: Function Attrs: mustprogress noinline nounwind sanitize_address
+// CHECK-KASAN: Function Attrs: mustprogress noinline nounwind sanitize_address
+// CHECK-HWASAN: Function Attrs: mustprogress noinline nounwind sanitize_hwaddress
+// CHECK-KHWASAN: Function Attrs: mustprogress noinline nounwind sanitize_hwaddress
__attribute__((no_sanitize("address"))) int NoSanitizeQuoteAddress() {
return 0;
}
-// CHECK-NOASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-ASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-KASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-HWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress$}}
-// CHECK-KHWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress$}}
+// CHECK-NOASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-ASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-KASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-HWASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_hwaddress$}}
+// CHECK-KHWASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_hwaddress$}}
__attribute__((no_sanitize_address)) int NoSanitizeAddress() { return 0; }
-// CHECK-NOASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-ASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-KASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-HWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress$}}
-// CHECK-KHWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress$}}
+// CHECK-NOASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-ASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-KASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-HWASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_hwaddress$}}
+// CHECK-KHWASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_hwaddress$}}
__attribute__((no_sanitize("kernel-address"))) int NoSanitizeKernelAddress() {
return 0;
}
-// CHECK-NOASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-ASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-KASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-HWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress$}}
-// CHECK-KHWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress$}}
+// CHECK-NOASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-ASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-KASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-HWASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_hwaddress$}}
+// CHECK-KHWASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_hwaddress$}}
__attribute__((no_sanitize("hwaddress"))) int NoSanitizeHWAddress() {
return 0;
}
-// CHECK-NOASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-ASAN: {{Function Attrs: noinline nounwind sanitize_address$}}
-// CHECK-KASAN: {{Function Attrs: noinline nounwind sanitize_address$}}
-// CHECK-HWASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-KHWASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-NOASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-ASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_address$}}
+// CHECK-KASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_address$}}
+// CHECK-HWASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-KHWASAN: {{Function Attrs: mustprogress noinline nounwind$}}
__attribute__((no_sanitize("kernel-hwaddress"))) int NoSanitizeKernelHWAddress() {
return 0;
}
-// CHECK-NOASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-ASAN: {{Function Attrs: noinline nounwind sanitize_address$}}
-// CHECK-KASAN: {{Function Attrs: noinline nounwind sanitize_address$}}
-// CHECK-HWASAN: {{Function Attrs: noinline nounwind$}}
-// CHECK-KHWASAN: {{Function Attrs: noinline nounwind$}}
+// CHECK-NOASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-ASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_address$}}
+// CHECK-KASAN: {{Function Attrs: mustprogress noinline nounwind sanitize_address$}}
+// CHECK-HWASAN: {{Function Attrs: mustprogress noinline nounwind$}}
+// CHECK-KHWASAN: {{Function Attrs: mustprogress noinline nounwind$}}
__attribute__((disable_sanitizer_instrumentation)) int DisableSanitizerInstrumentation() {
return 0;
}
-// CHECK-NOASAN: {{Function Attrs: disable_sanitizer_instrumentation noinline nounwind$}}
-// CHECK-ASAN: {{Function Attrs: disable_sanitizer_instrumentation noinline nounwind$}}
-// CHECK-KASAN: {{Function Attrs: disable_sanitizer_instrumentation noinline nounwind$}}
-// CHECK-HWASAN: {{Function Attrs: disable_sanitizer_instrumentation noinline nounwind$}}
-// CHECK-KHWASAN: {{Function Attrs: disable_sanitizer_instrumentation noinline nounwind$}}
+// CHECK-NOASAN: {{Function Attrs: disable_sanitizer_instrumentation mustprogress noinline nounwind$}}
+// CHECK-ASAN: {{Function Attrs: disable_sanitizer_instrumentation mustprogress noinline nounwind$}}
+// CHECK-KASAN: {{Function Attrs: disable_sanitizer_instrumentation mustprogress noinline nounwind$}}
+// CHECK-HWASAN: {{Function Attrs: disable_sanitizer_instrumentation mustprogress noinline nounwind$}}
+// CHECK-KHWASAN: {{Function Attrs: disable_sanitizer_instrumentation mustprogress noinline nounwind$}}
diff --git a/clang/test/CodeGen/address-safety-attr.cpp b/clang/test/CodeGen/address-safety-attr.cpp
index 7aeda9a80dcd94..bd899ed2f9a749 100644
--- a/clang/test/CodeGen/address-safety-attr.cpp
+++ b/clang/test/CodeGen/address-safety-attr.cpp
@@ -148,7 +148,7 @@ int global2 = *(int*)((char*)&global1+1);
// BLFILE: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
// BLFUNC: attributes [[WITH]] = { noinline nounwind sanitize_address{{.*}} }
-// BLFUNC: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
+// BLFUNC: attributes [[NOATTR]] = { mustprogress noinline nounwind{{.*}} }
// ASAN: attributes [[WITH]] = { noinline nounwind sanitize_address{{.*}} }
-// ASAN: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
+// ASAN: attributes [[NOATTR]] = { mustprogress noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGen/debug-names-compound-type-units.ll b/clang/test/CodeGen/debug-names-compound-type-units.ll
index bb9f41b82f061e..62cecfdeaf7f94 100644
--- a/clang/test/CodeGen/debug-names-compound-type-units.ll
+++ b/clang/test/CodeGen/debug-names-compound-type-units.ll
@@ -29,7 +29,7 @@ target triple = "x86_64-unknown-linux-gnu"
%struct.Foo2 = type { i8, %struct.Foo }
%struct.Foo = type { i8 }
-; Function Attrs: noinline nounwind optnone uwtable
+; Function Attrs: mustprogress noinline nounwind optnone uwtable
define dso_local void @_Z7fooFuncv() #0 !dbg !10 {
entry:
%global2 = alloca %struct.Foo2, align 1
@@ -40,7 +40,7 @@ entry:
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+attributes #0 = { mustprogress noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.dbg.cu = !{!0}
diff --git a/clang/test/CodeGen/fp-floatcontrol-stack.cpp b/clang/test/CodeGen/fp-floatcontrol-stack.cpp
index d8bff72ac13037..090da25d21207d 100644
--- a/clang/test/CodeGen/fp-floatcontrol-stack.cpp
+++ b/clang/test/CodeGen/fp-floatcontrol-stack.cpp
@@ -6,10 +6,10 @@
#define FUN(n) \
(float z) { return n * z + n; }
-// CHECK-DDEFAULT: Function Attrs: noinline nounwind optnone{{$$}}
-// CHECK-DEBSTRICT: Function Attrs: noinline nounwind optnone strictfp{{$$}}
-// CHECK-FAST: Function Attrs: noinline nounwind optnone{{$$}}
-// CHECK-NOHONOR: Function Attrs: noinline nounwind optnone{{$$}}
+// CHECK-DDEFAULT: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+// CHECK-DEBSTRICT: Function Attrs: mustprogress noinline nounwind optnone strictfp{{$$}}
+// CHECK-FAST: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+// CHECK-NOHONOR: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
float fun_default FUN(1)
//CHECK-LABEL: define {{.*}} @_Z11fun_defaultf{{.*}}
#if DEFAULT
@@ -32,10 +32,10 @@ float fun_default FUN(1)
// Rule: precise must be enabled
#pragma float_control(except, on)
#endif
- // CHECK-FAST: Function Attrs: noinline nounwind optnone{{$$}}
- // CHECK-DDEFAULT: Function Attrs: noinline nounwind optnone strictfp{{$$}}
- // CHECK-DEBSTRICT: Function Attrs: noinline nounwind optnone strictfp{{$$}}
- // CHECK-NOHONOR: Function Attrs: noinline nounwind optnone strictfp{{$$}}
+ // CHECK-FAST: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+ // CHECK-DDEFAULT: Function Attrs: mustprogress noinline nounwind optnone strictfp{{$$}}
+ // CHECK-DEBSTRICT: Function Attrs: mustprogress noinline nounwind optnone strictfp{{$$}}
+ // CHECK-NOHONOR: Function Attrs: mustprogress noinline nounwind optnone strictfp{{$$}}
float exc_on FUN(2)
//CHECK-LABEL: define {{.*}} @_Z6exc_onf{{.*}}
#if DEFAULT
@@ -54,10 +54,10 @@ float fun_default FUN(1)
#endif
#pragma float_control(pop)
- // CHECK-DDEFAULT: Function Attrs: noinline nounwind optnone{{$$}}
- // CHECK-DEBSTRICT: Function Attrs: noinline nounwind optnone strictfp{{$$}}
- // CHECK-FAST: Function Attrs: noinline nounwind optnone{{$$}}
- // CHECK-NOHONOR: Function Attrs: noinline nounwind optnone{{$$}}
+ // CHECK-DDEFAULT: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+ // CHECK-DEBSTRICT: Function Attrs: mustprogress noinline nounwind optnone strictfp{{$$}}
+ // CHECK-FAST: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+ // CHECK-NOHONOR: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
float exc_pop FUN(5)
//CHECK-LABEL: define {{.*}} @_Z7exc_popf{{.*}}
#if DEFAULT
@@ -223,10 +223,10 @@ float fun_default FUN(1)
#pragma float_control(except, on)
#endif
float y();
-// CHECK-DDEFAULT: Function Attrs: noinline nounwind optnone{{$$}}
-// CHECK-DEBSTRICT: Function Attrs: noinline nounwind optnone strictfp{{$$}}
-// CHECK-FAST: Function Attrs: noinline nounwind optnone{{$$}}
-// CHECK-NOHONOR: Function Attrs: noinline nounwind optnone{{$$}}
+// CHECK-DDEFAULT: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+// CHECK-DEBSTRICT: Function Attrs: mustprogress noinline nounwind optnone strictfp{{$$}}
+// CHECK-FAST: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+// CHECK-NOHONOR: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
class ON {
// Settings for top level class initializer use program source setting.
float z = 2 + y() * 7;
@@ -246,10 +246,10 @@ class ON {
};
ON on;
#pragma float_control(except, off)
-// CHECK-DDEFAULT: Function Attrs: noinline nounwind optnone{{$$}}
-// CHECK-DEBSTRICT: Function Attrs: noinline nounwind optnone{{$$}}
-// CHECK-FAST: Function Attrs: noinline nounwind optnone{{$$}}
-// CHECK-NOHONOR: Function Attrs: noinline nounwind optnone{{$$}}
+// CHECK-DDEFAULT: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+// CHECK-DEBSTRICT: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+// CHECK-FAST: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
+// CHECK-NOHONOR: Function Attrs: mustprogress noinline nounwind optnone{{$$}}
class OFF {
float w = 2 + y() * 7;
// CHECK-LABEL: define {{.*}} void @_ZN3OFFC2Ev{{.*}}
diff --git a/clang/test/CodeGen/sanitize-thread-attr.cpp b/clang/test/CodeGen/sanitize-thread-attr.cpp
index ef861dfe8e42b0..15ae3a16df696a 100644
--- a/clang/test/CodeGen/sanitize-thread-attr.cpp
+++ b/clang/test/CodeGen/sanitize-thread-attr.cpp
@@ -58,5 +58,5 @@ int global2 = *(int*)((char*)&global1+1);
// BL: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
-// TSAN: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
+// TSAN: attributes [[NOATTR]] = { mustprogress noinline nounwind{{.*}} }
// TSAN: attributes [[WITH]] = { noinline nounwind sanitize_thread{{.*}} }
diff --git a/clang/test/CodeGenCXX/apple-kext.cpp b/clang/test/CodeGenCXX/apple-kext.cpp
index d49ef2a0ccfa1b..2cba0be7a006af 100644
--- a/clang/test/CodeGenCXX/apple-kext.cpp
+++ b/clang/test/CodeGenCXX/apple-kext.cpp
@@ -38,5 +38,5 @@ namespace test0 {
// CHECK: call void @_ZN5test01AD1Ev(ptr @_ZN5test01aE)
// CHECK-NEXT: ret void
-// CHECK: attributes #[[ATTR0]] = { alwaysinline nounwind {{.*}} }
-// CHECK: attributes #[[ATTR1]] = { noinline nounwind {{.*}} }
+// CHECK: attributes #[[ATTR0]] = { alwaysinline mustprogress nounwind {{.*}} }
+// CHECK: attributes #[[ATTR1]] = { mustprogress noinline nounwind {{.*}} }
diff --git a/clang/test/CodeGenCXX/attr-mustprogress.cpp b/clang/test/CodeGenCXX/attr-mustprogress.cpp
index 6179712f285404..5a24e9426d1308 100644
--- a/clang/test/CodeGenCXX/attr-mustprogress.cpp
+++ b/clang/test/CodeGenCXX/attr-mustprogress.cpp
@@ -6,10 +6,10 @@
// Check -ffinite-loops option in combination with various standard versions.
// RUN: %clang_cc1 -std=c++98 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=FINITE %s
-// RUN: %clang_cc1 -std=c++11 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=FINITE %s
-// RUN: %clang_cc1 -std=c++14 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=FINITE %s
-// RUN: %clang_cc1 -std=c++17 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=FINITE %s
-// RUN: %clang_cc1 -std=c++20 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=FINITE %s
+// RUN: %clang_cc1 -std=c++11 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s
+// RUN: %clang_cc1 -std=c++14 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s
+// RUN: %clang_cc1 -std=c++17 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s
+// RUN: %clang_cc1 -std=c++20 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s
// Check -fno-finite-loops option in combination with various standard versions.
// RUN: %clang_cc1 -std=c++98 -fno-finite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX98 %s
@@ -23,6 +23,9 @@ int b = 0;
// CHECK: datalayout
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2f0v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %for.cond
@@ -34,6 +37,9 @@ void f0() {
for (; ;) ;
}
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2f1v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %for.cond
@@ -51,6 +57,9 @@ void f1() {
;
}
+// CXX98-NOT: mustprogress
+// CXX11: mustprogress
+// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2f2v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %for.cond
@@ -71,6 +80,9 @@ void f2() {
;
}
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z1Fv(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %for.cond
@@ -101,6 +113,9 @@ void F() {
;
}
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2F2v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %for.cond
@@ -131,6 +146,9 @@ void F2() {
;
}
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2w1v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %while.body
@@ -144,6 +162,9 @@ void w1() {
;
}
+// CXX98-NOT: mustprogress
+// CXX11: mustprogress
+// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2w2v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %while.cond
@@ -164,6 +185,9 @@ void w2() {
;
}
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z1Wv(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %while.cond
@@ -190,6 +214,9 @@ void W() {
;
}
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2W2v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %while.body
@@ -205,6 +232,9 @@ void W2() {
;
}
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2d1v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %do.body
@@ -223,6 +253,9 @@ void d1() {
while (1);
}
+// CXX98-NOT: mustprogress
+// CXX11: mustprogress
+// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2d2v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %do.body
@@ -244,6 +277,9 @@ void d2() {
while (a == b);
}
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z1Dv(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %do.body
@@ -276,6 +312,9 @@ void D() {
while (a == b);
}
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// FINITE-NOT: mustprogress
// CHECK-LABEL: @_Z2D2v(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %do.body
diff --git a/clang/test/CodeGenCXX/attr-target-clones-aarch64.cpp b/clang/test/CodeGenCXX/attr-target-clones-aarch64.cpp
index c15f46cde54bfc..7953f902bf09b2 100644
--- a/clang/test/CodeGenCXX/attr-target-clones-aarch64.cpp
+++ b/clang/test/CodeGenCXX/attr-target-clones-aarch64.cpp
@@ -230,11 +230,11 @@ void run_foo_tml() {
// CHECK-NEXT: ret i32 2
//
//.
-// CHECK: attributes #[[ATTR0:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon" }
-// CHECK: attributes #[[ATTR1:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+ls64" }
-// CHECK: attributes #[[ATTR2:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
-// CHECK: attributes #[[ATTR3:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fptoint" }
-// CHECK: attributes #[[ATTR4:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme,+sme-f64f64" }
+// CHECK: attributes #[[ATTR0:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon" }
+// CHECK: attributes #[[ATTR1:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+ls64" }
+// CHECK: attributes #[[ATTR2:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// CHECK: attributes #[[ATTR3:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fptoint" }
+// CHECK: attributes #[[ATTR4:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme,+sme-f64f64" }
//.
// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
// CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
diff --git a/clang/test/CodeGenCXX/attr-target-version.cpp b/clang/test/CodeGenCXX/attr-target-version.cpp
index c9a22372f26f86..8b7273fe3bb517 100644
--- a/clang/test/CodeGenCXX/attr-target-version.cpp
+++ b/clang/test/CodeGenCXX/attr-target-version.cpp
@@ -312,17 +312,17 @@ int bar() {
// CHECK-NEXT: ret ptr @_ZN7MyClass40unused_with_implicit_forward_default_defEv.default
//
//.
-// CHECK: attributes #[[ATTR0:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme,+sme-f64f64" }
-// CHECK: attributes #[[ATTR1:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
-// CHECK: attributes #[[ATTR2:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+fp-armv8,+neon,+sm4" }
-// CHECK: attributes #[[ATTR3:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc" }
-// CHECK: attributes #[[ATTR4:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+dotprod,+fp-armv8,+neon" }
-// CHECK: attributes #[[ATTR5:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+mops" }
-// CHECK: attributes #[[ATTR6:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon" }
-// CHECK: attributes #[[ATTR7:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sve" }
-// CHECK: attributes #[[ATTR8:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon" }
-// CHECK: attributes #[[ATTR9:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+lse" }
-// CHECK: attributes #[[ATTR10:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon,+rdm" }
+// CHECK: attributes #[[ATTR0:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme,+sme-f64f64" }
+// CHECK: attributes #[[ATTR1:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// CHECK: attributes #[[ATTR2:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+fp-armv8,+neon,+sm4" }
+// CHECK: attributes #[[ATTR3:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc" }
+// CHECK: attributes #[[ATTR4:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+dotprod,+fp-armv8,+neon" }
+// CHECK: attributes #[[ATTR5:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+mops" }
+// CHECK: attributes #[[ATTR6:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon" }
+// CHECK: attributes #[[ATTR7:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sve" }
+// CHECK: attributes #[[ATTR8:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon" }
+// CHECK: attributes #[[ATTR9:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+lse" }
+// CHECK: attributes #[[ATTR10:[0-9]+]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon,+rdm" }
// CHECK: attributes #[[ATTR11:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
//.
// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
diff --git a/clang/test/CodeGenCXX/cxx11-exception-spec.cpp b/clang/test/CodeGenCXX/cxx11-exception-spec.cpp
index 3991c5170d14fc..08de8868b47100 100644
--- a/clang/test/CodeGenCXX/cxx11-exception-spec.cpp
+++ b/clang/test/CodeGenCXX/cxx11-exception-spec.cpp
@@ -121,7 +121,7 @@ void j() {
}
// CHECK: attributes [[NONE]] = { {{.*}} }
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
// CHECK: attributes [[NUW2]] = { nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/cxx11-noreturn.cpp b/clang/test/CodeGenCXX/cxx11-noreturn.cpp
index 58a5a377133a59..feea72ef3f4503 100644
--- a/clang/test/CodeGenCXX/cxx11-noreturn.cpp
+++ b/clang/test/CodeGenCXX/cxx11-noreturn.cpp
@@ -7,4 +7,4 @@ int g();
while (g()) {}
}
-// CHECK: attributes [[NR]] = { noinline noreturn nounwind{{.*}} }
+// CHECK: attributes [[NR]] = { mustprogress noinline noreturn nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/derived-to-base.cpp b/clang/test/CodeGenCXX/derived-to-base.cpp
index 8b49d56a68d44f..c8dbd5bf5cb05c 100644
--- a/clang/test/CodeGenCXX/derived-to-base.cpp
+++ b/clang/test/CodeGenCXX/derived-to-base.cpp
@@ -46,4 +46,4 @@ namespace test3 {
}
}
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/main-norecurse.cpp b/clang/test/CodeGenCXX/main-norecurse.cpp
index a98677ce6f5999..3a476e6a119a25 100644
--- a/clang/test/CodeGenCXX/main-norecurse.cpp
+++ b/clang/test/CodeGenCXX/main-norecurse.cpp
@@ -5,4 +5,4 @@ int main(int argc, char **argv) {
return 1;
}
-// CHECK: attributes #0 = { noinline norecurse{{.*}} }
+// CHECK: attributes #0 = { mustprogress noinline norecurse{{.*}} }
diff --git a/clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp b/clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
index d60b4fefbf688e..1cc0e9af571c3a 100644
--- a/clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
+++ b/clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
@@ -62,4 +62,4 @@ struct S {
void delete_s(S *s) { delete[] s; }
}
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/no-exceptions.cpp b/clang/test/CodeGenCXX/no-exceptions.cpp
index c951b685a8a1bf..47f491e50e8f12 100644
--- a/clang/test/CodeGenCXX/no-exceptions.cpp
+++ b/clang/test/CodeGenCXX/no-exceptions.cpp
@@ -3,7 +3,7 @@
void g();
// CHECK: define{{.*}} void @_Z1fv() [[NUW:#[0-9]+]]
-void f() throw (int) {
+void f() throw (int) {
// CHECK-NOT: invoke void @_Z1gv
g();
@@ -11,4 +11,4 @@ void f() throw (int) {
// CHECK: ret void
}
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/noinline-template.cpp b/clang/test/CodeGenCXX/noinline-template.cpp
index 507ca3f34af51f..cb81f72d0714f3 100644
--- a/clang/test/CodeGenCXX/noinline-template.cpp
+++ b/clang/test/CodeGenCXX/noinline-template.cpp
@@ -15,4 +15,4 @@ void foo() {
strs.growStorageBy();
}
-// CHECK: attributes [[NI]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NI]] = { mustprogress noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/optnone-and-attributes.cpp b/clang/test/CodeGenCXX/optnone-and-attributes.cpp
index 870d5e9496f04e..68aa0988b18b59 100644
--- a/clang/test/CodeGenCXX/optnone-and-attributes.cpp
+++ b/clang/test/CodeGenCXX/optnone-and-attributes.cpp
@@ -75,8 +75,8 @@ int exported_optnone_func(int a) {
// CHECK: declare dllimport {{.*}} @_Z21imported_optnone_funci({{.*}}) [[DLLIMPORT:#[0-9]+]]
-// CHECK: attributes [[OPTNONE]] = { noinline {{.*}} optnone
-// CHECK: attributes [[NORETURN]] = { noinline noreturn {{.*}} optnone
+// CHECK: attributes [[OPTNONE]] = { mustprogress noinline {{.*}} optnone
+// CHECK: attributes [[NORETURN]] = { mustprogress noinline noreturn {{.*}} optnone
// CHECK: attributes [[DLLIMPORT]] =
// CHECK-NOT: optnone
diff --git a/clang/test/CodeGenCXX/optnone-def-decl.cpp b/clang/test/CodeGenCXX/optnone-def-decl.cpp
index 6e4e510b9bf6ec..9e7d295ea31d47 100644
--- a/clang/test/CodeGenCXX/optnone-def-decl.cpp
+++ b/clang/test/CodeGenCXX/optnone-def-decl.cpp
@@ -89,7 +89,7 @@ int user_of_forceinline_optnone_function() {
// CHECK: @_Z36user_of_forceinline_optnone_functionv() [[NORMAL]]
// CHECK: @_Z28forceinline_optnone_functionii({{.*}}) [[OPTNONE]]
-// CHECK: attributes [[OPTNONE]] = { noinline nounwind optnone {{.*}} }
+// CHECK: attributes [[OPTNONE]] = { mustprogress noinline nounwind optnone {{.*}} }
// CHECK: attributes [[NORMAL]] =
// CHECK-NOT: noinline
// CHECK-NOT: optnone
diff --git a/clang/test/CodeGenCXX/pr58798.cpp b/clang/test/CodeGenCXX/pr58798.cpp
index ced8823e571e73..607b36aa7f69a9 100644
--- a/clang/test/CodeGenCXX/pr58798.cpp
+++ b/clang/test/CodeGenCXX/pr58798.cpp
@@ -1,7 +1,7 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --check-attributes
// RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-linux-gnu -fexceptions -fcxx-exceptions | FileCheck %s
-// CHECK: Function Attrs: noinline nounwind optnone willreturn memory(read)
+// CHECK: Function Attrs: mustprogress noinline nounwind optnone willreturn memory(read)
// CHECK-LABEL: define {{[^@]+}}@_Z54early_caller_of_callee_with_clang_attr_with_clang_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR0:[0-9]+]] {
// CHECK-NEXT: entry:
@@ -12,7 +12,7 @@
// CHECK-NEXT: ret i32 [[CALL]]
//
-// CHECK: Function Attrs: noinline nounwind optnone willreturn memory(read)
+// CHECK: Function Attrs: mustprogress noinline nounwind optnone willreturn memory(read)
// CHECK-LABEL: define {{[^@]+}}@_Z22callee_with_clang_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR0]] {
// CHECK-NEXT: entry:
@@ -30,7 +30,7 @@
// CHECK-NEXT: ret i32 24
//
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: mustprogress noinline nounwind optnone
// CHECK-LABEL: define {{[^@]+}}@_Z52early_caller_of_callee_with_clang_attr_with_cxx_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR1:[0-9]+]] {
// CHECK-NEXT: entry:
@@ -41,7 +41,7 @@
// CHECK-NEXT: ret i32 [[CALL]]
//
-// CHECK: Function Attrs: noinline nounwind optnone willreturn memory(read)
+// CHECK: Function Attrs: mustprogress noinline nounwind optnone willreturn memory(read)
// CHECK-LABEL: define {{[^@]+}}@_Z52early_caller_of_callee_with_cxx_attr_with_clang_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR0]] {
// CHECK-NEXT: entry:
@@ -52,7 +52,7 @@
// CHECK-NEXT: ret i32 [[CALL]]
//
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: mustprogress noinline nounwind optnone
// CHECK-LABEL: define {{[^@]+}}@_Z20callee_with_cxx_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR1]] personality ptr @__gxx_personality_v0 {
// CHECK-NEXT: entry:
@@ -78,7 +78,7 @@
// CHECK-NEXT: unreachable
//
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: mustprogress noinline nounwind optnone
// CHECK-LABEL: define {{[^@]+}}@_Z50early_caller_of_callee_with_cxx_attr_with_cxx_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR1]] {
// CHECK-NEXT: entry:
@@ -129,7 +129,7 @@ int callee_with_cxx_attr(int a) noexcept {
// Calls to definitions:
-// CHECK: Function Attrs: noinline nounwind optnone willreturn memory(read)
+// CHECK: Function Attrs: mustprogress noinline nounwind optnone willreturn memory(read)
// CHECK-LABEL: define {{[^@]+}}@_Z53late_caller_of_callee_with_clang_attr_with_clang_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR0]] {
// CHECK-NEXT: entry:
@@ -143,7 +143,7 @@ __attribute__((pure)) int late_caller_of_callee_with_clang_attr_with_clang_attr(
return callee_with_clang_attr(a);
}
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: mustprogress noinline nounwind optnone
// CHECK-LABEL: define {{[^@]+}}@_Z51late_caller_of_callee_with_clang_attr_with_cxx_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR1]] {
// CHECK-NEXT: entry:
@@ -157,7 +157,7 @@ int late_caller_of_callee_with_clang_attr_with_cxx_attr(int a) noexcept {
return callee_with_clang_attr(a);
}
-// CHECK: Function Attrs: noinline nounwind optnone willreturn memory(read)
+// CHECK: Function Attrs: mustprogress noinline nounwind optnone willreturn memory(read)
// CHECK-LABEL: define {{[^@]+}}@_Z51late_caller_of_callee_with_cxx_attr_with_clang_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR0]] {
// CHECK-NEXT: entry:
@@ -171,7 +171,7 @@ __attribute__((pure)) int late_caller_of_callee_with_cxx_attr_with_clang_attr(in
return callee_with_cxx_attr(a);
}
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: mustprogress noinline nounwind optnone
// CHECK-LABEL: define {{[^@]+}}@_Z49late_caller_of_callee_with_cxx_attr_with_cxx_attri
// CHECK-SAME: (i32 noundef [[A:%.*]]) #[[ATTR1]] {
// CHECK-NEXT: entry:
diff --git a/clang/test/CodeGenCXX/reference-cast.cpp b/clang/test/CodeGenCXX/reference-cast.cpp
index 5cb0901c4b9ccb..e7b07365974d6f 100644
--- a/clang/test/CodeGenCXX/reference-cast.cpp
+++ b/clang/test/CodeGenCXX/reference-cast.cpp
@@ -15,7 +15,7 @@ const int &lvalue_noop_cast() {
return 17;
}
-// CHECK-LABEL: define{{.*}} nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) ptr @_Z20lvalue_integral_castv()
+// CHECK-LABEL: define{{.*}} nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) ptr @_Z20lvalue_integral_castv()
const short &lvalue_integral_cast() {
if (i == 0)
// CHECK: store i16 17, ptr
@@ -193,4 +193,4 @@ namespace PR10650 {
// CHECK: store i64
}
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/threadsafe-statics.cpp b/clang/test/CodeGenCXX/threadsafe-statics.cpp
index 443fbecc3d260a..4c53482d4c4c9b 100644
--- a/clang/test/CodeGenCXX/threadsafe-statics.cpp
+++ b/clang/test/CodeGenCXX/threadsafe-statics.cpp
@@ -22,6 +22,6 @@ void g() {
// NO-TSS-NOT: call void @__cxa_guard_release
// NO-TSS: ret void
-// WITH-TSS: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// WITH-TSS: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
-// NO-TSS: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// NO-TSS: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenCXX/thunks-ehspec.cpp b/clang/test/CodeGenCXX/thunks-ehspec.cpp
index 813d9a62724475..4c95a471114080 100644
--- a/clang/test/CodeGenCXX/thunks-ehspec.cpp
+++ b/clang/test/CodeGenCXX/thunks-ehspec.cpp
@@ -17,13 +17,13 @@ class C : A, B {
};
void C::primary_key() {}
-// CHECK-LABEL: define available_externally void @_ZThn8_N1C9secondaryEv(ptr noundef %this) {{.*}} #0
+// CHECK-LABEL: define available_externally void @_ZThn8_N1C9secondaryEv(ptr noundef %this) {{.*}} #2
// CHECK-NOT: invoke
// CHECK: tail call void @_ZN1C9secondaryEv(ptr {{[^,]*}} %{{.*}})
// CHECK-NOT: invoke
// CHECK: ret void
-// CHECK-LABEL: define available_externally void @_ZThn8_N1C16secondary_varargEiz(ptr noundef %this, i32 noundef %0, ...) {{.*}} #0
+// CHECK-LABEL: define available_externally void @_ZThn8_N1C16secondary_varargEiz(ptr noundef %this, i32 noundef %0, ...) {{.*}} #2
// CHECK-NOT: invoke
-// CHECK: musttail call void (ptr, i32, ...) @_ZN1C16secondary_varargEiz(ptr {{[^,]*}} %{{.*}}, i32 noundef %{{.*}}, ...) #2
+// CHECK: musttail call void (ptr, i32, ...) @_ZN1C16secondary_varargEiz(ptr {{[^,]*}} %{{.*}}, i32 noundef %{{.*}}, ...) #3
// CHECK-NEXT: ret void
diff --git a/clang/test/CodeGenCXX/thunks.cpp b/clang/test/CodeGenCXX/thunks.cpp
index 394dc8d7665153..f1ceebf24ba189 100644
--- a/clang/test/CodeGenCXX/thunks.cpp
+++ b/clang/test/CodeGenCXX/thunks.cpp
@@ -529,7 +529,7 @@ C c;
// CHECK-NONOPT-LABEL: define linkonce_odr void @_ZThn8_N6Test101C3fooEv
// Checking with opt
-// CHECK-OPT-LABEL: define internal void @_ZThn8_N6Test4B12_GLOBAL__N_11C1fEv(ptr noundef %this) unnamed_addr #0 align 2
+// CHECK-OPT-LABEL: define internal void @_ZThn8_N6Test4B12_GLOBAL__N_11C1fEv(ptr noundef %this) unnamed_addr #1 align 2
// This is from Test5:
// CHECK-OPT-LABEL: define linkonce_odr void @_ZTv0_n24_N5Test51B1fEv
diff --git a/clang/test/CodeGenCXX/virtual-base-cast.cpp b/clang/test/CodeGenCXX/virtual-base-cast.cpp
index a6b4672eddc835..57388431e90076 100644
--- a/clang/test/CodeGenCXX/virtual-base-cast.cpp
+++ b/clang/test/CodeGenCXX/virtual-base-cast.cpp
@@ -75,4 +75,4 @@ BB* d() { return y; }
// MSVC: add nsw i32 4, %[[offset]]
// MSVC: }
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenHIP/default-attributes.hip b/clang/test/CodeGenHIP/default-attributes.hip
index e1e1f4417fa438..63572bfd242b98 100644
--- a/clang/test/CodeGenHIP/default-attributes.hip
+++ b/clang/test/CodeGenHIP/default-attributes.hip
@@ -8,7 +8,7 @@
#define __device__ __attribute__((device))
#define __global__ __attribute__((global))
-// OPTNONE: Function Attrs: convergent noinline nounwind optnone
+// OPTNONE: Function Attrs: convergent mustprogress noinline nounwind optnone
// OPTNONE-LABEL: define {{[^@]+}}@_Z4funcv
// OPTNONE-SAME: () #[[ATTR0:[0-9]+]] {
// OPTNONE-NEXT: entry:
@@ -24,7 +24,7 @@ __device__ void func() {
}
-// OPTNONE: Function Attrs: convergent noinline norecurse nounwind optnone
+// OPTNONE: Function Attrs: convergent mustprogress noinline norecurse nounwind optnone
// OPTNONE-LABEL: define {{[^@]+}}@_Z6kernelv
// OPTNONE-SAME: () #[[ATTR1:[0-9]+]] {
// OPTNONE-NEXT: entry:
@@ -40,8 +40,8 @@ __global__ void kernel() {
}
//.
-// OPTNONE: attributes #0 = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
-// OPTNONE: attributes #1 = { convergent noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,1024" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
+// OPTNONE: attributes #0 = { convergent mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// OPTNONE: attributes #1 = { convergent mustprogress noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,1024" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
//.
// OPT: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
// OPT: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) "amdgpu-flat-work-group-size"="1,1024" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
diff --git a/clang/test/CodeGenObjCXX/lambda-expressions.mm b/clang/test/CodeGenObjCXX/lambda-expressions.mm
index 1afbde04ab0fa5..e1fb6ec709b727 100644
--- a/clang/test/CodeGenObjCXX/lambda-expressions.mm
+++ b/clang/test/CodeGenObjCXX/lambda-expressions.mm
@@ -163,5 +163,5 @@ void test() {
#endif
-// ARC: attributes [[NUW]] = { noinline nounwind{{.*}} }
-// MRC: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// ARC: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
+// MRC: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
diff --git a/clang/test/CodeGenSYCL/function-attrs.cpp b/clang/test/CodeGenSYCL/function-attrs.cpp
index 21bef5b4a961d5..1606f961f2d391 100644
--- a/clang/test/CodeGenSYCL/function-attrs.cpp
+++ b/clang/test/CodeGenSYCL/function-attrs.cpp
@@ -49,7 +49,7 @@ int main() {
return 0;
}
//.
-// CHECK: attributes #0 = { convergent noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// CHECK: attributes #0 = { convergent mustprogress noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
// CHECK: attributes #1 = { convergent nounwind }
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
diff --git a/clang/test/Modules/aarch64-sme-keywords.cppm b/clang/test/Modules/aarch64-sme-keywords.cppm
index 4852d7e10d602f..759701a633cebe 100644
--- a/clang/test/Modules/aarch64-sme-keywords.cppm
+++ b/clang/test/Modules/aarch64-sme-keywords.cppm
@@ -31,7 +31,7 @@ import A;
//
// CHECK:declare void @_ZW1A14f_preserves_zav() #[[PRESERVES_ZA_DECL:[0-9]+]]
//
-// CHECK:; Function Attrs: noinline nounwind optnone
+// CHECK:; Function Attrs: mustprogress noinline nounwind optnone
// CHECK:define dso_local void @_Z21f_nonstreaming_callerv() #[[NORMAL_DEF:[0-9]+]] {
// CHECK:entry:
// CHECK: call void @_ZW1A11f_streamingv() #[[STREAMING_USE:[0-9]+]]
diff --git a/clang/test/OpenMP/amdgcn-attributes.cpp b/clang/test/OpenMP/amdgcn-attributes.cpp
index fd6497919e3b70..5ddc34537d12fb 100644
--- a/clang/test/OpenMP/amdgcn-attributes.cpp
+++ b/clang/test/OpenMP/amdgcn-attributes.cpp
@@ -32,12 +32,12 @@ int callable(int x) {
return x + 1;
}
-// DEFAULT: attributes #0 = { convergent noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "kernel" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
-// CPU: attributes #0 = { convergent noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "kernel" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" "uniform-work-group-size"="true" }
-// NOIEEE: attributes #0 = { convergent noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "amdgpu-ieee"="false" "kernel" "no-nans-fp-math"="true" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
-// UNSAFEATOMIC: attributes #0 = { convergent noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "amdgpu-unsafe-fp-atomics"="true" "kernel" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
-
-// DEFAULT: attributes #2 = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
-// CPU: attributes #2 = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" }
-// NOIEEE: attributes #2 = { convergent noinline nounwind optnone "amdgpu-ieee"="false" "no-nans-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
-// UNSAFEATOMIC: attributes #2 = { convergent noinline nounwind optnone "amdgpu-unsafe-fp-atomics"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// DEFAULT: attributes #0 = { convergent mustprogress noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "kernel" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
+// CPU: attributes #0 = { convergent mustprogress noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "kernel" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" "uniform-work-group-size"="true" }
+// NOIEEE: attributes #0 = { convergent mustprogress noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "amdgpu-ieee"="false" "kernel" "no-nans-fp-math"="true" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
+// UNSAFEATOMIC: attributes #0 = { convergent mustprogress noinline norecurse nounwind optnone "amdgpu-flat-work-group-size"="1,42" "amdgpu-unsafe-fp-atomics"="true" "kernel" "no-trapping-math"="true" "omp_target_thread_limit"="42" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
+
+// DEFAULT: attributes #2 = { convergent mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// CPU: attributes #2 = { convergent mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" }
+// NOIEEE: attributes #2 = { convergent mustprogress noinline nounwind optnone "amdgpu-ieee"="false" "no-nans-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// UNSAFEATOMIC: attributes #2 = { convergent mustprogress noinline nounwind optnone "amdgpu-unsafe-fp-atomics"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
diff --git a/clang/test/OpenMP/irbuilder_safelen.cpp b/clang/test/OpenMP/irbuilder_safelen.cpp
index 84a7d9fe2aeed5..4ce9e3918957ae 100644
--- a/clang/test/OpenMP/irbuilder_safelen.cpp
+++ b/clang/test/OpenMP/irbuilder_safelen.cpp
@@ -244,7 +244,8 @@ void simple(float *a, float *b, int *c) {
// CHECK-NEXT: ret void
//
//.
-// CHECK: attributes #0 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #1 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
// CHECK: !1 = !{i32 7, !"openmp", i32 45}
diff --git a/clang/test/OpenMP/irbuilder_safelen_order_concurrent.cpp b/clang/test/OpenMP/irbuilder_safelen_order_concurrent.cpp
index 5d3c8f240963da..f82a7b229356cb 100644
--- a/clang/test/OpenMP/irbuilder_safelen_order_concurrent.cpp
+++ b/clang/test/OpenMP/irbuilder_safelen_order_concurrent.cpp
@@ -244,7 +244,8 @@ void simple(float *a, float *b, int *c) {
// CHECK-NEXT: ret void
//
//.
-// CHECK: attributes #0 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #1 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
// CHECK: !1 = !{i32 7, !"openmp", i32 50}
diff --git a/clang/test/OpenMP/irbuilder_simd_aligned.cpp b/clang/test/OpenMP/irbuilder_simd_aligned.cpp
index fa35946de3b474..db8f19cd56b14e 100644
--- a/clang/test/OpenMP/irbuilder_simd_aligned.cpp
+++ b/clang/test/OpenMP/irbuilder_simd_aligned.cpp
@@ -282,8 +282,9 @@ void simple(float *a, float *b, int *c) {
// CHECK-NEXT: ret void
//
//.
-// CHECK: attributes #0 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
-// CHECK: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
+// CHECK: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #1 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
// CHECK: !1 = !{i32 7, !"openmp", i32 50}
diff --git a/clang/test/OpenMP/irbuilder_simdlen.cpp b/clang/test/OpenMP/irbuilder_simdlen.cpp
index 7a081542cda8b7..99261faff383df 100644
--- a/clang/test/OpenMP/irbuilder_simdlen.cpp
+++ b/clang/test/OpenMP/irbuilder_simdlen.cpp
@@ -244,7 +244,8 @@ void simple(float *a, float *b, int *c) {
// CHECK-NEXT: ret void
//
//.
-// CHECK: attributes #0 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #1 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
// CHECK: !1 = !{i32 7, !"openmp", i32 45}
diff --git a/clang/test/OpenMP/irbuilder_simdlen_safelen.cpp b/clang/test/OpenMP/irbuilder_simdlen_safelen.cpp
index 44796c9f3f20fd..13a1db4ced5ab3 100644
--- a/clang/test/OpenMP/irbuilder_simdlen_safelen.cpp
+++ b/clang/test/OpenMP/irbuilder_simdlen_safelen.cpp
@@ -244,7 +244,8 @@ void simple(float *a, float *b, int *c) {
// CHECK-NEXT: ret void
//
//.
-// CHECK: attributes #0 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+// CHECK: attributes #1 = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
//.
// CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
// CHECK: !1 = !{i32 7, !"openmp", i32 45}
diff --git a/clang/test/OpenMP/parallel_if_codegen_PR51349.cpp b/clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
index 120685011f70bb..1c6a56239204c3 100644
--- a/clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
+++ b/clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
@@ -14,7 +14,7 @@ void foo() {
}
#endif
-// CHECK: Function Attrs: nounwind
+// CHECK: Function Attrs: mustprogress nounwind
// CHECK-LABEL: define {{[^@]+}}@_Z3foov
// CHECK-SAME: () #[[ATTR0:[0-9]+]] {
// CHECK-NEXT: entry:
@@ -52,7 +52,7 @@ void foo() {
// CHECK-NEXT: ret void
//
//
-// CHECK-NOINLINE: Function Attrs: noinline nounwind
+// CHECK-NOINLINE: Function Attrs: mustprogress noinline nounwind
// CHECK-NOINLINE-LABEL: define {{[^@]+}}@_Z3foov
// CHECK-NOINLINE-SAME: () #[[ATTR0:[0-9]+]] {
// CHECK-NOINLINE-NEXT: entry:
diff --git a/clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected b/clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected
index b04e95944d999a..dd9e33cf8a381f 100644
--- a/clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected
+++ b/clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected
@@ -11,7 +11,7 @@ struct ST {
struct RT Z;
};
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: mustprogress noinline nounwind optnone
// CHECK-LABEL: @_Z3fooP2ST(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[S_ADDR:%.*]] = alloca ptr, align 8
>From 9e656a86946ddbbadb09e8e20e2a0b2426bb6db3 Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Mon, 29 Apr 2024 22:12:34 +0200
Subject: [PATCH 7/8] Fix tests and Address Shafik's comments
---
clang/lib/CodeGen/CGStmt.cpp | 7 +-
clang/lib/CodeGen/CodeGenFunction.cpp | 2 +-
clang/test/CodeGenCXX/attr-mustprogress.cpp | 81 ++++++++++++++++++---
3 files changed, 76 insertions(+), 14 deletions(-)
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 6aa6117c006352..a3c66e433b37b4 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -910,13 +910,13 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression,
bool IsTrivialCXXLoop) {
- if (CGM.getCodeGenOpts().getFiniteLoops() ==
- CodeGenOptions::FiniteLoopsKind::Always)
- return true;
if (CGM.getCodeGenOpts().getFiniteLoops() ==
CodeGenOptions::FiniteLoopsKind::Never)
return false;
+ if(CGM.getCodeGenOpts().getFiniteLoops() == CodeGenOptions::FiniteLoopsKind::Always
+ && !getLangOpts().CPlusPlus11)
+ return true;
// Now apply rules for plain C (see 6.8.5.6 in C11).
// Loops with constant conditions do not have to make progress in any C
// version.
@@ -950,7 +950,6 @@ bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression,
}
return true;
}
-
return false;
}
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 95c0784ad9760c..6e50d373919839 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1465,7 +1465,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
// Ensure that the function adheres to the forward progress guarantee, which
// is required by certain optimizations.
- // The attribute will be removed if the body contains a trivial empty loop.
+ // In C++11 and up, the attribute will be removed if the body contains a trivial empty loop.
if (checkIfFunctionMustProgress())
CurFn->addFnAttr(llvm::Attribute::MustProgress);
diff --git a/clang/test/CodeGenCXX/attr-mustprogress.cpp b/clang/test/CodeGenCXX/attr-mustprogress.cpp
index 5a24e9426d1308..3706415fd3a894 100644
--- a/clang/test/CodeGenCXX/attr-mustprogress.cpp
+++ b/clang/test/CodeGenCXX/attr-mustprogress.cpp
@@ -222,7 +222,7 @@ void W() {
// CHECK-NEXT: br label %while.body
// CHECK: while.body:
// CXX98-NOT: br {{.*}}, !llvm.loop
-// CXX11-NOT: br label %while.body, !llvm.loop [[LOOP12:!.*]]
+// CXX11-NOT: br {{.*}}, !llvm.loop
// FINITE-NEXT: br label %while.body, !llvm.loop [[LOOP12:!.*]]
//
void W2() {
@@ -347,12 +347,75 @@ void D2() {
while (1);
}
-// CXX11: [[LOOP1:.*]] = distinct !{[[LOOP1]], [[MP:.*]]}
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// FINITE-NOT: mustprogress
+// CHECK-LABEL: @_Z9compound0v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %for.cond
+// CHECK: for.cond:
+// CXX98-NOT: br {{.*}} llvm.loop
+// CXX11-NOT: br {{.*}} llvm.loop
+// FINITE-NEXT: br label %for.cond, !llvm.loop [[LOOP19:!.*]]
+void compound0() {
+ for (; ;) {}
+}
+
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// FINITE-NOT: mustprogress
+// CHECK-LABEL: @_Z9compound1v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %for.cond
+// CHECK: for.cond:
+// CXX98-NOT: br {{.*}} llvm.loop
+// CXX11-NOT: br {{.*}} llvm.loop
+// FINITE-NEXT: br label %for.cond, !llvm.loop [[LOOP20:!.*]]
+void compound1() {
+ for (; ;) {/*! */}
+}
+
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// FINITE-NOT: mustprogress
+// CHECK-LABEL: @_Z9compound2v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %do.body
+// CHECK: do.body:
+// CHECK-NEXT: br label %do.cond
+// CHECK: do.cond:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NOT: br {{.*}}, !llvm.loop
+// FINITE-NEXT: br i1 true, label %do.body, label %do.end, !llvm.loop [[LOOP21:!.*]]
+// CHECK: do.end:
+// CHECK-NEXT: ret void
+//
+void compound2() {
+ do {} while (1+1);
+}
+
+// CXX98-NOT: mustprogress
+// CXX11 : mustprogress
+// FINITE-NOT: mustprogress
+// CHECK-LABEL: @_Z5Falsev(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %do.body
+// CHECK: do.body:
+// CHECK-NEXT: br label %do.end
+// CHECK: do.end:
+// CHECK-NEXT: ret void
+//
+void False() {
+ do {} while (1-1);
+}
+
+
+// CXX11: [[LOOP3]] = distinct !{[[LOOP3]], [[MP:.*]]}
// CXX11: [[MP]] = !{!"llvm.loop.mustprogress"}
-// CXX11: [[LOOP2:.*]] = distinct !{[[LOOP2]], [[MP]]}
-// CXX11: [[LOOP3:.*]] = distinct !{[[LOOP3]], [[MP]]}
-// CXX11: [[LOOP4:.*]] = distinct !{[[LOOP4]], [[MP]]}
-// CXX11: [[LOOP5:.*]] = distinct !{[[LOOP5]], [[MP]]}
-// CXX11: [[LOOP6:.*]] = distinct !{[[LOOP6]], [[MP]]}
-// CXX11: [[LOOP7:.*]] = distinct !{[[LOOP7]], [[MP]]}
-// CXX11: [[LOOP8:.*]] = distinct !{[[LOOP8]], [[MP]]}
+// CXX11: [[LOOP5]] = distinct !{[[LOOP5]], [[MP]]}
+// CXX11: [[LOOP6]] = distinct !{[[LOOP6]], [[MP]]}
+// CXX11: [[LOOP9]] = distinct !{[[LOOP9]], [[MP]]}
+// CXX11: [[LOOP10]] = distinct !{[[LOOP10]], [[MP]]}
+// CXX11: [[LOOP14]] = distinct !{[[LOOP14]], [[MP]]}
+// CXX11: [[LOOP16]] = distinct !{[[LOOP16]], [[MP]]}
+// CXX11: [[LOOP17]] = distinct !{[[LOOP17]], [[MP]]}
>From b99e8b2408241da23f2d4aafb5b600609f4596fc Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Tue, 30 Apr 2024 15:36:08 +0200
Subject: [PATCH 8/8] Format
---
clang/lib/CodeGen/CGStmt.cpp | 5 +++--
clang/lib/CodeGen/CodeGenFunction.cpp | 3 ++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index a3c66e433b37b4..f06a7e9a91a148 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -914,8 +914,9 @@ bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression,
CodeGenOptions::FiniteLoopsKind::Never)
return false;
- if(CGM.getCodeGenOpts().getFiniteLoops() == CodeGenOptions::FiniteLoopsKind::Always
- && !getLangOpts().CPlusPlus11)
+ if (CGM.getCodeGenOpts().getFiniteLoops() ==
+ CodeGenOptions::FiniteLoopsKind::Always &&
+ !getLangOpts().CPlusPlus11)
return true;
// Now apply rules for plain C (see 6.8.5.6 in C11).
// Loops with constant conditions do not have to make progress in any C
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 3196d059060ea1..546beae4af59e5 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1471,7 +1471,8 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
// Ensure that the function adheres to the forward progress guarantee, which
// is required by certain optimizations.
- // In C++11 and up, the attribute will be removed if the body contains a trivial empty loop.
+ // In C++11 and up, the attribute will be removed if the body contains a
+ // trivial empty loop.
if (checkIfFunctionMustProgress())
CurFn->addFnAttr(llvm::Attribute::MustProgress);
More information about the cfe-commits
mailing list