diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-02-03 21:30:34 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-02-03 21:30:34 +0000 |
commit | a53b5bbb184d02c6a8fa1fca8a5bafb2cf16195f (patch) | |
tree | 2fbe01d560aba8930559e60e897cfe3dbeba32e7 /llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | fa8681e45245be394a62fb1efae38f44d1884959 (diff) | |
download | llvm-a53b5bbb184d02c6a8fa1fca8a5bafb2cf16195f.zip llvm-a53b5bbb184d02c6a8fa1fca8a5bafb2cf16195f.tar.gz llvm-a53b5bbb184d02c6a8fa1fca8a5bafb2cf16195f.tar.bz2 |
[LoopStrengthReduce] Don't rewrite PHIs with incoming values from CatchSwitches
Bail out if we have a PHI on an EHPad that gets a value from a
CatchSwitchInst. Because the CatchSwitchInst cannot be split, there is
no good place to stick any instructions.
This fixes PR26373.
llvm-svn: 259702
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 2101225..acfdec4 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -4799,6 +4799,17 @@ LSRInstance::LSRInstance(Loop *L, IVUsers &IU, ScalarEvolution &SE, DEBUG(dbgs() << "LSR skipping loop, too many IV Users in " << U << "\n"); return; } + // Bail out if we have a PHI on an EHPad that gets a value from a + // CatchSwitchInst. Because the CatchSwitchInst cannot be split, there is + // no good place to stick any instructions. + if (auto *PN = dyn_cast<PHINode>(U.getUser())) { + auto *FirstNonPHI = PN->getParent()->getFirstNonPHI(); + if (isa<FuncletPadInst>(FirstNonPHI) || + isa<CatchSwitchInst>(FirstNonPHI)) + for (BasicBlock *PredBB : PN->blocks()) + if (isa<CatchSwitchInst>(PredBB->getFirstNonPHI())) + return; + } } #ifndef NDEBUG |