diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2023-01-13 00:05:19 +0300 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2023-01-13 00:41:58 +0300 |
commit | 3c5b1f2d94d021005ce3769a4402d4a4ae843989 (patch) | |
tree | d4edd4ac4633efe13accb33a2aef6271311a22a1 /llvm/lib/Transforms/Utils/Local.cpp | |
parent | a5c23d55842a31eb83b7968866e69d1731411580 (diff) | |
download | llvm-3c5b1f2d94d021005ce3769a4402d4a4ae843989.zip llvm-3c5b1f2d94d021005ce3769a4402d4a4ae843989.tar.gz llvm-3c5b1f2d94d021005ce3769a4402d4a4ae843989.tar.bz2 |
[SimplifyCFG] When eliminating `unreachable` landing pads, mark `call`s as `nounwind`
We really can't recover that knowledge, and `nounwind` knowledge,
(and not just a lack of the unwind edge, aka `call` instead of `invoke`),
is e.g. part of the reasoning in e.g. `mayHaveSideEffects()`.
Note that this is call-site-specific knowledge,
just because some callsite had an `unreachable`
unwind edge, does not mean that all will.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index d5d0232..569eee3 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -2557,11 +2557,14 @@ static bool markAliveBlocks(Function &F, return Changed; } -void llvm::removeUnwindEdge(BasicBlock *BB, DomTreeUpdater *DTU) { +void llvm::removeUnwindEdge(BasicBlock *BB, bool WouldUnwindBeUB, + DomTreeUpdater *DTU) { Instruction *TI = BB->getTerminator(); if (auto *II = dyn_cast<InvokeInst>(TI)) { - changeToCall(II, DTU); + CallInst *CI = changeToCall(II, DTU); + if (WouldUnwindBeUB && !CI->doesNotThrow()) + CI->setDoesNotThrow(); return; } |