[llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Nov 25 14:11:01 PST 2003


Changes in directory llvm/lib/Analysis:

BasicAliasAnalysis.cpp updated: 1.17 -> 1.18

---
Log message:

Use gep_type_begin/end instead of looking for ubytes


---
Diffs of the changes:  (+7 -4)

Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.17 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.18
--- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.17	Tue Nov 25 12:33:40 2003
+++ llvm/lib/Analysis/BasicAliasAnalysis.cpp	Tue Nov 25 14:10:07 2003
@@ -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 @@
   //
   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...





More information about the llvm-commits mailing list