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 | 3a7a68c10880c2a28387617b42d14d774e218727 (patch) | |
tree | 19703b7ade7ad668d0c54a0d0f97d2f0bce51d82 /lib/Analysis/BasicAliasAnalysis.cpp | |
parent | 8f080f0233ce28044182e3c81f3ebc12d43e081e (diff) |
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/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | lib/Analysis/BasicAliasAnalysis.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index c10c6f3f27..dcb5903a14 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -23,6 +23,7 @@ #include "llvm/Instructions.h" #include "llvm/IntrinsicInst.h" #include "llvm/LLVMContext.h" +#include "llvm/Operator.h" #include "llvm/Pass.h" #include "llvm/Target/TargetData.h" #include "llvm/ADT/SmallVector.h" @@ -38,10 +39,11 @@ using namespace llvm; //===----------------------------------------------------------------------===// static const User *isGEP(const Value *V) { - if (isa<GetElementPtrInst>(V) || - (isa<ConstantExpr>(V) && - cast<ConstantExpr>(V)->getOpcode() == Instruction::GetElementPtr)) - return cast<User>(V); + if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V)) + // For the purposes of BasicAliasAnalysis, if the GEP has overflow it + // could do crazy things. + if (GEP->hasNoPointerOverflow()) + return GEP; return 0; } |