diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-03-30 21:12:06 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-03-30 21:12:06 +0000 |
commit | 5d518386b658f51e18e77d31e2f823c171572b71 (patch) | |
tree | 651018acda3c8482de9079ca6efdf6dba5085e28 /llvm/lib/Transforms | |
parent | bbaf5e0acf8870dd1b77afeb7ab09bf875d29b01 (diff) | |
download | bcm5719-llvm-5d518386b658f51e18e77d31e2f823c171572b71.tar.gz bcm5719-llvm-5d518386b658f51e18e77d31e2f823c171572b71.zip |
[IndVarSimplify] Don't insert after a catchswitch
Widening a PHI requires us to insert a trunc.
The logical place for this trunc is in the same BB as the PHI.
This is not possible if the BB is terminated by a catchswitch.
This fixes PR27133.
llvm-svn: 264926
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index c9dec3b28dc..ecbb1481d62 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -1283,6 +1283,12 @@ Instruction *WidenIV::widenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter) { if (UsePhi->getNumOperands() != 1) truncateIVUse(DU, DT, LI); else { + // Widening the PHI requires us to insert a trunc. The logical place + // for this trunc is in the same BB as the PHI. This is not possible if + // the BB is terminated by a catchswitch. + if (isa<CatchSwitchInst>(UsePhi->getParent()->getTerminator())) + return nullptr; + PHINode *WidePhi = PHINode::Create(DU.WideDef->getType(), 1, UsePhi->getName() + ".wide", UsePhi); |