diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-07-21 21:23:38 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-07-26 16:35:14 +0200 |
commit | 33146857e9840a92840d48bbc3483e34ea545fc7 (patch) | |
tree | d061f2f0d02b7dfc800b63c229a7b38fc5e88827 /llvm/lib/Analysis/DemandedBits.cpp | |
parent | 404f0d4f7cc7b7497c9725c6c6f20b21df8611bb (diff) | |
download | llvm-33146857e9840a92840d48bbc3483e34ea545fc7.zip llvm-33146857e9840a92840d48bbc3483e34ea545fc7.tar.gz llvm-33146857e9840a92840d48bbc3483e34ea545fc7.tar.bz2 |
[IR] Consider non-willreturn as side effect (PR50511)
This adjusts mayHaveSideEffect() to return true for !willReturn()
instructions. Just like other side-effects, non-willreturn calls
(aka "divergence") cannot be removed and cannot be reordered relative
to other side effects. This fixes a number of bugs where
non-willreturn calls are either incorrectly dropped or moved. In
particular, it also fixes the last open problem in
https://bugs.llvm.org/show_bug.cgi?id=50511.
I performed a cursory review of all current mayHaveSideEffect()
uses, which convinced me that these are indeed the desired default
semantics. Places that do not want to consider non-willreturn as a
sideeffect generally do not want mayHaveSideEffect() semantics at
all. I identified two such cases, which are addressed by D106591
and D106742. Finally, there is a use in SCEV for which we don't
really have an appropriate API right now -- what it wants is
basically "would this be considered forward progress". I've just
spelled out the previous semantics there.
Differential Revision: https://reviews.llvm.org/D106749
Diffstat (limited to 'llvm/lib/Analysis/DemandedBits.cpp')
-rw-r--r-- | llvm/lib/Analysis/DemandedBits.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/DemandedBits.cpp b/llvm/lib/Analysis/DemandedBits.cpp index 467dea9..ca6d58f 100644 --- a/llvm/lib/Analysis/DemandedBits.cpp +++ b/llvm/lib/Analysis/DemandedBits.cpp @@ -80,7 +80,7 @@ void DemandedBitsWrapperPass::print(raw_ostream &OS, const Module *M) const { static bool isAlwaysLive(Instruction *I) { return I->isTerminator() || isa<DbgInfoIntrinsic>(I) || I->isEHPad() || - I->mayHaveSideEffects() || !I->willReturn(); + I->mayHaveSideEffects(); } void DemandedBits::determineLiveOperandBits( |