[clang] Add mustprogress and llvm.loop.mustprogress attribute deduction
authorAtmn Patel <a335pate@uwaterloo.ca>
Mon, 2 Nov 2020 21:03:21 +0000 (16:03 -0500)
committerAtmn Patel <a335pate@uwaterloo.ca>
Thu, 5 Nov 2020 03:03:14 +0000 (22:03 -0500)
commitac73b73c16526c9e51943759ea6cab285a57e33f
tree0002a0e6b5a0ae7368d355a729e32294d33224aa
parentbbd4ebffd4a634a9256f5eb33b3cce06ade8d809
[clang] Add mustprogress and llvm.loop.mustprogress attribute deduction

Since C++11, the C++ standard has a forward progress guarantee
[intro.progress], so all such functions must have the `mustprogress`
requirement. In addition, from C11 and onwards, loops without a non-zero
constant conditional or no conditional are also required to make
progress (C11 6.8.5p6). This patch implements these attribute deductions
so they can be used by the optimization passes.

Differential Revision: https://reviews.llvm.org/D86841
40 files changed:
clang/lib/CodeGen/CGLoopInfo.cpp
clang/lib/CodeGen/CGLoopInfo.h
clang/lib/CodeGen/CGStmt.cpp
clang/lib/CodeGen/CodeGenFunction.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/test/CodeGen/address-safety-attr-flavors.cpp
clang/test/CodeGen/address-safety-attr.cpp
clang/test/CodeGen/attr-mustprogress-0.c [new file with mode: 0644]
clang/test/CodeGen/attr-mustprogress-0.cpp [new file with mode: 0644]
clang/test/CodeGen/attr-mustprogress-1.c [new file with mode: 0644]
clang/test/CodeGen/attr-mustprogress-1.cpp [new file with mode: 0644]
clang/test/CodeGen/memtag-attr.cpp
clang/test/CodeGen/no-builtin.cpp
clang/test/CodeGen/pragma-do-while.cpp
clang/test/CodeGenCXX/attr-likelihood-iteration-stmt.cpp
clang/test/CodeGenCXX/cxx11-trivial-initializer-struct.cpp
clang/test/CodeGenCXX/debug-info-line-if.cpp
clang/test/CodeGenCXX/debug-info-loops.cpp
clang/test/CodeGenCXX/fno-unroll-loops-metadata.cpp
clang/test/CodeGenCXX/pragma-followup_inner.cpp
clang/test/CodeGenCXX/pragma-followup_outer.cpp
clang/test/CodeGenCXX/pragma-loop-distribute.cpp
clang/test/CodeGenCXX/pragma-loop-pr27643.cpp
clang/test/CodeGenCXX/pragma-loop-predicate.cpp
clang/test/CodeGenCXX/pragma-loop-safety-imperfectly_nested.cpp
clang/test/CodeGenCXX/pragma-loop-safety-nested.cpp
clang/test/CodeGenCXX/pragma-loop-safety-outer.cpp
clang/test/CodeGenCXX/pragma-loop-safety.cpp
clang/test/CodeGenCXX/pragma-loop.cpp
clang/test/CodeGenCXX/pragma-pipeline.cpp
clang/test/CodeGenCXX/pragma-unroll-and-jam.cpp
clang/test/CodeGenCXX/pragma-unroll.cpp
clang/test/CodeGenCXX/thunks-ehspec.cpp
clang/test/CodeGenCXX/thunks.cpp
clang/test/OpenMP/simd_metadata.c
clang/test/Profile/c-unprofiled-blocks.c
clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected
clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected