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

Chris Lattner sabre at nondot.org
Sat Jan 13 21:58:08 PST 2007



Changes in directory llvm/lib/Analysis:

BasicAliasAnalysis.cpp updated: 1.100 -> 1.101
---
Log message:

fit to 80 cols.
Remove now-extraneous checks for ptr->ptr bitcasts.

Fix PR1109: http://llvm.org/PR1109  and Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll.  We
need to consider arbitrary sized objects when checking for nested GEP offsets.


---
Diffs of the changes:  (+6 -8)

 BasicAliasAnalysis.cpp |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)


Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.100 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.101
--- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.100	Fri Jan 12 12:20:48 2007
+++ llvm/lib/Analysis/BasicAliasAnalysis.cpp	Sat Jan 13 23:57:53 2007
@@ -104,7 +104,7 @@
     bool pointsToConstantMemory(const Value *P);
 
     virtual ModRefBehavior getModRefBehavior(Function *F, CallSite CS,
-                                             std::vector<PointerAccessInfo> *Info);
+                                          std::vector<PointerAccessInfo> *Info);
 
   private:
     // CheckGEPInstructions - Check two GEP instructions with known
@@ -274,11 +274,9 @@
 
   // Strip off cast instructions...
   if (const BitCastInst *I = dyn_cast<BitCastInst>(V1))
-    if (isa<PointerType>(I->getOperand(0)->getType()))
-      return alias(I->getOperand(0), V1Size, V2, V2Size);
+    return alias(I->getOperand(0), V1Size, V2, V2Size);
   if (const BitCastInst *I = dyn_cast<BitCastInst>(V2))
-    if (isa<PointerType>(I->getOperand(0)->getType()))
-      return alias(V1, V1Size, I->getOperand(0), V2Size);
+    return alias(V1, V1Size, I->getOperand(0), V2Size);
 
   // Figure out what objects these things are pointing to if we can...
   const Value *O1 = getUnderlyingObject(V1);
@@ -363,7 +361,7 @@
        Constant::getNullValue(cast<User>(BasePtr2)->getOperand(1)->getType()));
 
     // Do the base pointers alias?
-    AliasResult BaseAlias = alias(BasePtr1, V1Size, BasePtr2, V2Size);
+    AliasResult BaseAlias = alias(BasePtr1, ~0U, BasePtr2, ~0U);
     if (BaseAlias == NoAlias) return NoAlias;
     if (BaseAlias == MustAlias) {
       // If the base pointers alias each other exactly, check to see if we can
@@ -694,9 +692,9 @@
           // value possible.
           //
           if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty))
-            GEP1Ops[i] = ConstantInt::get(Type::Int64Ty, AT->getNumElements()-1);
+            GEP1Ops[i] = ConstantInt::get(Type::Int64Ty,AT->getNumElements()-1);
           else if (const PackedType *PT = dyn_cast<PackedType>(BasePtr1Ty))
-            GEP1Ops[i] = ConstantInt::get(Type::Int64Ty, PT->getNumElements()-1);
+            GEP1Ops[i] = ConstantInt::get(Type::Int64Ty,PT->getNumElements()-1);
 
         }
       }






More information about the llvm-commits mailing list