summaryrefslogtreecommitdiff
path: root/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-02-10 23:54:10 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-02-10 23:54:10 +0000
commit3b739d278c87f8ac22b5dc368b319fa278347b2f (patch)
tree38d264e0e347f1b60ba4ab886858726ece2b6cd0 /lib/Analysis/ValueTracking.cpp
parent2c2b933037ecd5a0ebcfa3077606892802c04a29 (diff)
downloadllvm-3b739d278c87f8ac22b5dc368b319fa278347b2f.tar.gz
llvm-3b739d278c87f8ac22b5dc368b319fa278347b2f.tar.bz2
llvm-3b739d278c87f8ac22b5dc368b319fa278347b2f.tar.xz
Tolerate degenerate phi nodes that can occur in the middle of optimization
passes. Fixes PR9112. Patch by Jakub Staszak! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ValueTracking.cpp')
-rw-r--r--lib/Analysis/ValueTracking.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index 44c1b5326b..32d2c88721 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/lib/Analysis/ValueTracking.cpp
@@ -590,6 +590,10 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
}
}
+ // Unreachable blocks may have zero-operand PHI nodes.
+ if (P->getNumIncomingValues() == 0)
+ return;
+
// Otherwise take the unions of the known bit sets of the operands,
// taking conservative care to avoid excessive recursion.
if (Depth < MaxDepth - 1 && !KnownZero && !KnownOne) {