aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2023-01-13 20:44:41 +0300
committerRoman Lebedev <lebedev.ri@gmail.com>2023-01-13 21:04:17 +0300
commit333cdd41255adb122b1a3cedac5bc6aef5c0982c (patch)
treee341dad3bb6f4be47bb72028d56461febda72135 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parent6ca1a09f03e8e940f306bea73efa935e4ee38173 (diff)
downloadllvm-333cdd41255adb122b1a3cedac5bc6aef5c0982c.zip
llvm-333cdd41255adb122b1a3cedac5bc6aef5c0982c.tar.gz
llvm-333cdd41255adb122b1a3cedac5bc6aef5c0982c.tar.bz2
[SimplifyCFG] Reapply: when eliminating `unreachable` landing pads, mark `call`s as `nounwind`
This time the change is in it's least intrusive form since only the return type in prototype for `removeUnwindEdge()` is changed, since only a single specific caller need that knowledge. 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/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index a235158..9e04839 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -5184,7 +5184,9 @@ bool SimplifyCFGOpt::simplifyUnreachable(UnreachableInst *UI) {
DTU->applyUpdates(Updates);
Updates.clear();
}
- removeUnwindEdge(TI->getParent(), DTU);
+ auto *CI = cast<CallInst>(removeUnwindEdge(TI->getParent(), DTU));
+ if (!CI->doesNotThrow())
+ CI->setDoesNotThrow();
Changed = true;
}
} else if (auto *CSI = dyn_cast<CatchSwitchInst>(TI)) {