Make this pass registration static as well.
[oota-llvm.git] / lib / Analysis / BasicAliasAnalysis.cpp
index 939fa6de45f5a06cfcef59f497645a79a6843831..b6072fdf876ede9d02bbdfe5a3a5fb7f7e5f5eac 100644 (file)
@@ -36,6 +36,10 @@ namespace {
   /// such it doesn't follow many of the rules that other alias analyses must.
   ///
   struct VISIBILITY_HIDDEN NoAA : public ImmutablePass, public AliasAnalysis {
+    static char ID; // Class identification, replacement for typeinfo
+    NoAA() : ImmutablePass((intptr_t)&ID) {}
+    explicit NoAA(intptr_t PID) : ImmutablePass(PID) { }
+
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<TargetData>();
     }
@@ -74,6 +78,7 @@ namespace {
   };
 
   // Register this pass...
+  char NoAA::ID = 0;
   RegisterPass<NoAA>
   U("no-aa", "No Alias Analysis (always returns 'may' alias)");
 
@@ -88,6 +93,8 @@ namespace {
   /// Because it doesn't chain to a previous alias analysis (like -no-aa), it
   /// derives from the NoAA class.
   struct VISIBILITY_HIDDEN BasicAliasAnalysis : public NoAA {
+    static char ID; // Class identification, replacement for typeinfo
+    BasicAliasAnalysis() : NoAA((intptr_t)&ID) { }
     AliasResult alias(const Value *V1, unsigned V1Size,
                       const Value *V2, unsigned V2Size);
 
@@ -119,6 +126,7 @@ namespace {
   };
 
   // Register this pass...
+  char BasicAliasAnalysis::ID = 0;
   RegisterPass<BasicAliasAnalysis>
   X("basicaa", "Basic Alias Analysis (default AA impl)");
 
@@ -620,7 +628,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
     if (NumGEP1Ops > MinOperands) {
       for (unsigned i = FirstConstantOper; i != MaxOperands; ++i)
         if (isa<ConstantInt>(GEP1Ops[i]) && 
-            !cast<Constant>(GEP1Ops[i])->isNullValue()) {
+            !cast<ConstantInt>(GEP1Ops[i])->isZero()) {
           // Yup, there's a constant in the tail.  Set all variables to
           // constants in the GEP instruction to make it suiteable for
           // TargetData::getIndexedOffset.
@@ -689,7 +697,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
           if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) {
             if (Op1C->getZExtValue() >= AT->getNumElements())
               return MayAlias;  // Be conservative with out-of-range accesses
-          } else if (const PackedType *PT = dyn_cast<PackedType>(BasePtr1Ty)) {
+          } else if (const VectorType *PT = dyn_cast<VectorType>(BasePtr1Ty)) {
             if (Op1C->getZExtValue() >= PT->getNumElements())
               return MayAlias;  // Be conservative with out-of-range accesses
           }
@@ -707,7 +715,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
           //
           if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty))
             GEP1Ops[i] = ConstantInt::get(Type::Int64Ty,AT->getNumElements()-1);
-          else if (const PackedType *PT = dyn_cast<PackedType>(BasePtr1Ty))
+          else if (const VectorType *PT = dyn_cast<VectorType>(BasePtr1Ty))
             GEP1Ops[i] = ConstantInt::get(Type::Int64Ty,PT->getNumElements()-1);
 
         }
@@ -719,7 +727,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
           if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) {
             if (Op2C->getZExtValue() >= AT->getNumElements())
               return MayAlias;  // Be conservative with out-of-range accesses
-          } else if (const PackedType *PT = dyn_cast<PackedType>(BasePtr1Ty)) {
+          } else if (const VectorType *PT = dyn_cast<VectorType>(BasePtr1Ty)) {
             if (Op2C->getZExtValue() >= PT->getNumElements())
               return MayAlias;  // Be conservative with out-of-range accesses
           }