diff options
author | Chris Lattner <sabre@nondot.org> | 2003-11-25 20:10:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-11-25 20:10:07 +0000 |
commit | 1af55e169396dfa057f0a6067fa8b16eb4317909 (patch) | |
tree | c1eafb5708dcbb9eb6839508267432663d73ef46 /lib/Analysis/BasicAliasAnalysis.cpp | |
parent | bf6b5d0dbd9b2834f8439a6a311bb785be29bd06 (diff) |
Use gep_type_begin/end instead of looking for ubytes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10217 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | lib/Analysis/BasicAliasAnalysis.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 508daa2268..b2d407e29a 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -16,12 +16,12 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Pass.h" #include "llvm/Argument.h" -#include "llvm/iMemory.h" #include "llvm/iOther.h" #include "llvm/ConstantHandling.h" #include "llvm/GlobalValue.h" #include "llvm/DerivedTypes.h" #include "llvm/Target/TargetData.h" +#include "llvm/Support/GetElementPtrTypeIterator.h" using namespace llvm; // Make sure that anything that uses AliasAnalysis pulls in this file... @@ -288,11 +288,14 @@ BasicAliasAnalysis::CheckGEPInstructions(GetElementPtrInst *GEP1, unsigned G1S, // std::vector<Value*> Indices1; Indices1.reserve(NumGEPOperands-1); - for (unsigned i = 1; i != FirstConstantOper; ++i) - if (GEP1->getOperand(i)->getType() == Type::UByteTy) - Indices1.push_back(GEP1->getOperand(i)); + + for (gep_type_iterator I = gep_type_begin(GEP1); + I.getOperandNum() != FirstConstantOper; ++I) + if (isa<StructType>(*I)) + Indices1.push_back(I.getOperand()); else Indices1.push_back(Constant::getNullValue(Type::LongTy)); + std::vector<Value*> Indices2; Indices2.reserve(NumGEPOperands-1); Indices2 = Indices1; // Copy the zeros prefix... |