From 3b739d278c87f8ac22b5dc368b319fa278347b2f Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Thu, 10 Feb 2011 23:54:10 +0000 Subject: 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 --- lib/Analysis/ValueTracking.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/Analysis/ValueTracking.cpp') diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index 44c1b53..32d2c88 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) { -- cgit v1.1