[llvm-commits] [llvm] r69151 - /llvm/trunk/lib/VMCore/Value.cpp
Nick Lewycky
nicholas at mxc.ca
Tue Apr 14 23:23:41 PDT 2009
Author: nicholas
Date: Wed Apr 15 01:23:41 2009
New Revision: 69151
URL: http://llvm.org/viewvc/llvm-project?rev=69151&view=rev
Log:
Limit the number of times we're willing to chase pointers. Removes an O(n^2)
problem from instcombine.
Modified:
llvm/trunk/lib/VMCore/Value.cpp
Modified: llvm/trunk/lib/VMCore/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=69151&r1=69150&r2=69151&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Value.cpp (original)
+++ llvm/trunk/lib/VMCore/Value.cpp Wed Apr 15 01:23:41 2009
@@ -365,6 +365,7 @@
if (!isa<PointerType>(getType()))
return this;
Value *V = this;
+ unsigned MaxLookup = 6;
do {
if (Instruction *I = dyn_cast<Instruction>(V)) {
if (!isa<BitCastInst>(I) && !isa<GetElementPtrInst>(I))
@@ -379,7 +380,8 @@
return V;
}
assert(isa<PointerType>(V->getType()) && "Unexpected operand type!");
- } while (1);
+ } while (--MaxLookup);
+ return V;
}
/// DoPHITranslation - If this value is a PHI node with CurBB as its parent,
More information about the llvm-commits
mailing list