aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2021-07-02 17:17:55 +0300
committerRoman Lebedev <lebedev.ri@gmail.com>2021-07-02 17:17:55 +0300
commit24d271bb18bfdb314762ceebc10b57a9c50ed506 (patch)
tree2c4061b6ab3cacc5d4ec1d82d7f2e72a14784076 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parent93a1642763c9105f0e7d8388dcd7dfc6e2bae630 (diff)
downloadllvm-24d271bb18bfdb314762ceebc10b57a9c50ed506.zip
llvm-24d271bb18bfdb314762ceebc10b57a9c50ed506.tar.gz
llvm-24d271bb18bfdb314762ceebc10b57a9c50ed506.tar.bz2
Revert "https://godbolt.org/z/5vhv4K5b8"
This reverts commit 597ccc92ce4b0f90883406d1f78d9d776f602804.
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 8294a79..6288a62 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -4673,13 +4673,17 @@ bool SimplifyCFGOpt::simplifyUnreachable(UnreachableInst *UI) {
if (BBI->mayHaveSideEffects()) {
if (auto *SI = dyn_cast<StoreInst>(BBI)) {
- // Temporarily disable removal of volatile stores preceding unreachable,
- // pending a potential LangRef change permitting volatile stores to
- // trap.
- // TODO: Either remove this code, or properly integrate the check into
- // isGuaranteedToTransferExecutionToSuccessor().
if (SI->isVolatile())
break;
+ } else if (auto *LI = dyn_cast<LoadInst>(BBI)) {
+ if (LI->isVolatile())
+ break;
+ } else if (auto *RMWI = dyn_cast<AtomicRMWInst>(BBI)) {
+ if (RMWI->isVolatile())
+ break;
+ } else if (auto *CXI = dyn_cast<AtomicCmpXchgInst>(BBI)) {
+ if (CXI->isVolatile())
+ break;
} else if (isa<CatchPadInst>(BBI)) {
// A catchpad may invoke exception object constructors and such, which
// in some languages can be arbitrary code, so be conservative by
@@ -4688,9 +4692,8 @@ bool SimplifyCFGOpt::simplifyUnreachable(UnreachableInst *UI) {
if (classifyEHPersonality(BB->getParent()->getPersonalityFn()) !=
EHPersonality::CoreCLR)
break;
- } else if (!isa<LoadInst>(BBI) && !isa<AtomicRMWInst>(BBI) &&
- !isa<AtomicCmpXchgInst>(BBI) && !isa<FenceInst>(BBI) &&
- !isa<VAArgInst>(BBI) && !isa<LandingPadInst>(BBI)) {
+ } else if (!isa<FenceInst>(BBI) && !isa<VAArgInst>(BBI) &&
+ !isa<LandingPadInst>(BBI)) {
break;
}
// Note that deleting LandingPad's here is in fact okay, although it