aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-09-28 10:42:50 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-09-28 10:42:50 +0000
commit8be16fe70395c30762081388b8f6df323ddc82eb (patch)
treeb329dbdf6fc2101abba78455220e91b73093b7e0 /lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
parent53347ed2f8b6a80a36b0450a13eaa44da983ac3d (diff)
downloadexternal_llvm-8be16fe70395c30762081388b8f6df323ddc82eb.zip
external_llvm-8be16fe70395c30762081388b8f6df323ddc82eb.tar.gz
external_llvm-8be16fe70395c30762081388b8f6df323ddc82eb.tar.bz2
CorrelatedPropagation: BasicBlock::removePredecessor can simplify PHI nodes. If the it's the condition of a SwitchInst, reload it.
Fixes PR13972. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164818 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/CorrelatedValuePropagation.cpp')
-rw-r--r--lib/Transforms/Scalar/CorrelatedValuePropagation.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index 9b0aadb..3ec6f3d 100644
--- a/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -235,6 +235,11 @@ bool CorrelatedValuePropagation::processSwitch(SwitchInst *SI) {
// This case never fires - remove it.
CI.getCaseSuccessor()->removePredecessor(BB);
SI->removeCase(CI); // Does not invalidate the iterator.
+
+ // The condition can be modified by removePredecessor's PHI simplification
+ // logic.
+ Cond = SI->getCondition();
+
++NumDeadCases;
Changed = true;
} else if (State == LazyValueInfo::True) {