summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-11-06 23:59:23 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-11-06 23:59:23 +0000
commit27f2447fb32ed08b45dba7bad8260cd5312a5132 (patch)
treebdcf9dfb5dfedad6daa4b35bc209b684a538b7fd /llvm/lib
parentc8667622726a303bd56c50565ac07996377b1d49 (diff)
downloadbcm5719-llvm-27f2447fb32ed08b45dba7bad8260cd5312a5132.tar.gz
bcm5719-llvm-27f2447fb32ed08b45dba7bad8260cd5312a5132.zip
[InstCombine] Don't insert an instruction after a terminator
We tried to insert a cast of a phi in a block whose terminator is an EHPad. This is invalid. Do not attempt the transform in these circumstances. llvm-svn: 252370
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
index 1d3b837f124..a9f8f49d2f1 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
@@ -469,6 +469,12 @@ Instruction *InstCombiner::FoldPHIArgZextsIntoPHI(PHINode &Phi) {
/// only used by the PHI, PHI together their inputs, and do the operation once,
/// to the result of the PHI.
Instruction *InstCombiner::FoldPHIArgOpIntoPHI(PHINode &PN) {
+ // We cannot create a new instruction after the PHI if the terminator is an
+ // EHPad because there is no valid insertion point.
+ if (TerminatorInst *TI = PN.getParent()->getTerminator())
+ if (TI->isEHPad())
+ return nullptr;
+
Instruction *FirstInst = cast<Instruction>(PN.getIncomingValue(0));
if (isa<GetElementPtrInst>(FirstInst))
OpenPOWER on IntegriCloud