diff options
author | Dan Gohman <gohman@apple.com> | 2009-07-17 22:25:10 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-07-17 22:25:10 +0000 |
commit | b9010bc3bbfb0e8ca9020c0ed05ada8211ca29a0 (patch) | |
tree | 19703b7ade7ad668d0c54a0d0f97d2f0bce51d82 /lib/VMCore/Value.cpp | |
parent | ff9b4738e3aa98dbe088c10c815eaa44e38d45bd (diff) | |
download | external_llvm-b9010bc3bbfb0e8ca9020c0ed05ada8211ca29a0.zip external_llvm-b9010bc3bbfb0e8ca9020c0ed05ada8211ca29a0.tar.gz external_llvm-b9010bc3bbfb0e8ca9020c0ed05ada8211ca29a0.tar.bz2 |
Make BasicAliasAnalysis and Value::getUnderlyingObject use
GEPOperator's hasNoPointer0verflow(), and make a few places in instcombine
that create GEPs that may overflow clear the NoOverflow value. Among
other things, this partially addresses PR2831.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76252 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Value.cpp')
-rw-r--r-- | lib/VMCore/Value.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index b35ad50..3322c68 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -16,6 +16,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/InstrTypes.h" #include "llvm/Instructions.h" +#include "llvm/Operator.h" #include "llvm/Module.h" #include "llvm/ValueSymbolTable.h" #include "llvm/Support/Debug.h" @@ -372,15 +373,12 @@ Value *Value::getUnderlyingObject() { Value *V = this; unsigned MaxLookup = 6; do { - if (Instruction *I = dyn_cast<Instruction>(V)) { - if (!isa<BitCastInst>(I) && !isa<GetElementPtrInst>(I)) + if (Operator *O = dyn_cast<Operator>(V)) { + if (O->getOpcode() != Instruction::BitCast && + (O->getOpcode() != Instruction::GetElementPtr || + !cast<GEPOperator>(V)->hasNoPointerOverflow())) return V; - V = I->getOperand(0); - } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) { - if (CE->getOpcode() != Instruction::BitCast && - CE->getOpcode() != Instruction::GetElementPtr) - return V; - V = CE->getOperand(0); + V = O->getOperand(0); } else { return V; } |