diff options
author | Florian Hahn <flo@fhahn.com> | 2021-04-30 14:13:47 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2021-04-30 14:13:47 +0100 |
commit | 6c3129549374c0e81e28fd0a21e96f8087b63a78 (patch) | |
tree | 5b57b855ffb25c7eddb35740e88cc065afd4cd0b /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 66b8a16cc07c20f97f21c61d880f7924d47e597b (diff) | |
download | llvm-6c3129549374c0e81e28fd0a21e96f8087b63a78.zip llvm-6c3129549374c0e81e28fd0a21e96f8087b63a78.tar.gz llvm-6c3129549374c0e81e28fd0a21e96f8087b63a78.tar.bz2 |
[clang] Refactor mustprogress handling, add it to all loops in c++11+.
Currently Clang does not add mustprogress to inifinite loops with a
known constant condition, matching C11 behavior. The forward progress
guarantee in C++11 and later should allow us to add mustprogress to any
loop (http://eel.is/c++draft/intro.progress#1).
This allows us to simplify the code dealing with adding mustprogress a
bit.
Reviewed By: aaron.ballman, lebedev.ri
Differential Revision: https://reviews.llvm.org/D96418
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 09d49c9..d1937fd 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -1186,9 +1186,6 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, void CodeGenFunction::EmitFunctionBody(const Stmt *Body) { incrementProfileCounter(Body); - if (CPlusPlusWithProgress()) - FnIsMustProgress = true; - if (const CompoundStmt *S = dyn_cast<CompoundStmt>(Body)) EmitCompoundStmtWithoutScope(*S); else @@ -1196,7 +1193,7 @@ void CodeGenFunction::EmitFunctionBody(const Stmt *Body) { // This is checked after emitting the function body so we know if there // are any permitted infinite loops. - if (FnIsMustProgress) + if (checkIfFunctionMustProgress()) CurFn->addFnAttr(llvm::Attribute::MustProgress); } |