diff options
| author | Dan Gohman <gohman@apple.com> | 2010-12-15 20:10:26 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2010-12-15 20:10:26 +0000 |
| commit | 949ab7889c8cf02f8b321c8a0f451fd0effa7006 (patch) | |
| tree | b9d67f7dcf8e68dcfe2cd70f0896bb360365ad05 /llvm/lib/Analysis/ValueTracking.cpp | |
| parent | a4fcd2418dc7f0b425a3c1b4fb873fbe4e2e7f72 (diff) | |
| download | llvm-949ab7889c8cf02f8b321c8a0f451fd0effa7006.zip llvm-949ab7889c8cf02f8b321c8a0f451fd0effa7006.tar.gz llvm-949ab7889c8cf02f8b321c8a0f451fd0effa7006.tar.bz2 | |
Strengthen GetUnderlyingObject using InstructionSimplify.
While LLVM's main design is that analysis code shouldn't
go out of its way to understand code which hasn't been
InstCombined, analysis utility routines like this can
find themselves being called in the middle of transform
passes when instcombine hasn't had a chance to run.
llvm-svn: 121886
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
| -rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index d1b75c3..7506295 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Analysis/ValueTracking.h" +#include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/GlobalVariable.h" @@ -1440,6 +1441,14 @@ Value *llvm::GetUnderlyingObject(Value *V, unsigned MaxLookup) { return V; V = GA->getAliasee(); } else { + // See if InstructionSimplify knows any relevant tricks. + if (Instruction *I = dyn_cast<Instruction>(V)) + // TODO: Aquire TargetData and DominatorTree and use them. + if (Value *Simplified = SimplifyInstruction(I, 0, 0)) { + V = Simplified; + continue; + } + return V; } assert(V->getType()->isPointerTy() && "Unexpected operand type!"); |
