diff options
author | Bob Wilson <bob.wilson@apple.com> | 2010-01-25 18:26:54 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2010-01-25 18:26:54 +0000 |
commit | fc060e43376a8ab07e0310db7b27b2232e3f08a8 (patch) | |
tree | 4fcae9effe42dc61e704f4760d2eb5f3059e4301 /llvm/include | |
parent | 8a588e144424aba950d915123501a6ebb15cd21a (diff) | |
download | bcm5719-llvm-fc060e43376a8ab07e0310db7b27b2232e3f08a8.tar.gz bcm5719-llvm-fc060e43376a8ab07e0310db7b27b2232e3f08a8.zip |
Change Value::getUnderlyingObject to have the MaxLookup value specified as a
parameter with a default value, instead of just hardcoding it in the
implementation. The limit of MaxLookup = 6 was introduced in r69151 to fix
a performance problem with O(n^2) behavior in instcombine, but the scalarrepl
pass is relying on getUnderlyingObject to go all the way back to an AllocaInst.
Making the limit part of the method signature makes it clear that by default
the result is limited and should help avoid similar problems in the future.
This fixes pr6126.
llvm-svn: 94433
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/Value.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/include/llvm/Value.h b/llvm/include/llvm/Value.h index f0bd8bea1ed..9045906e7be 100644 --- a/llvm/include/llvm/Value.h +++ b/llvm/include/llvm/Value.h @@ -285,10 +285,11 @@ public: /// getUnderlyingObject - This method strips off any GEP address adjustments /// and pointer casts from the specified value, returning the original object /// being addressed. Note that the returned value has pointer type if the - /// specified value does. - Value *getUnderlyingObject(); - const Value *getUnderlyingObject() const { - return const_cast<Value*>(this)->getUnderlyingObject(); + /// specified value does. If the MaxLookup value is non-zero, it limits the + /// number of instructions to be stripped off. + Value *getUnderlyingObject(unsigned MaxLookup = 6); + const Value *getUnderlyingObject(unsigned MaxLookup = 6) const { + return const_cast<Value*>(this)->getUnderlyingObject(MaxLookup); } /// DoPHITranslation - If this value is a PHI node with CurBB as its parent, |