[llvm-commits] [llvm] r159687 - in /llvm/trunk/lib: Analysis/ValueTracking.cpp VMCore/Instructions.cpp
Nuno Lopes
nunoplopes at sapo.pt
Tue Jul 3 14:15:41 PDT 2012
Author: nlopes
Date: Tue Jul 3 16:15:40 2012
New Revision: 159687
URL: http://llvm.org/viewvc/llvm-project?rev=159687&view=rev
Log:
PHINode::hasConstantValue(): return undef if the PHI is fully recursive.
Thanks Duncan for the idea
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
llvm/trunk/lib/VMCore/Instructions.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=159687&r1=159686&r2=159687&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Tue Jul 3 16:15:40 2012
@@ -694,7 +694,7 @@
// taking conservative care to avoid excessive recursion.
if (Depth < MaxDepth - 1 && !KnownZero && !KnownOne) {
// Skip if every incoming value references to ourself.
- if (P->hasConstantValue() == P)
+ if (dyn_cast_or_null<UndefValue>(P->hasConstantValue()))
break;
KnownZero = APInt::getAllOnesValue(BitWidth);
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=159687&r1=159686&r2=159687&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Tue Jul 3 16:15:40 2012
@@ -167,6 +167,8 @@
// The case where the first value is this PHI.
ConstantValue = getIncomingValue(i);
}
+ if (ConstantValue == this)
+ return UndefValue::get(getType());
return ConstantValue;
}
More information about the llvm-commits
mailing list