[llvm-commits] [llvm] r111445 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp

Chris Lattner sabre at nondot.org
Wed Aug 18 15:52:09 PDT 2010


Author: lattner
Date: Wed Aug 18 17:52:09 2010
New Revision: 111445

URL: http://llvm.org/viewvc/llvm-project?rev=111445&view=rev
Log:
GetLinearExpression is only called when TD is non-null, pass as 
a reference instead of pointer.

Modified:
    llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=111445&r1=111444&r2=111445&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Wed Aug 18 17:52:09 2010
@@ -219,7 +219,7 @@
 /// have IntegerType.  Note that this looks through extends, so the high bits
 /// may not be represented in the result.
 static Value *GetLinearExpression(Value *V, APInt &Scale, APInt &Offset,
-                                  const TargetData *TD, unsigned Depth) {
+                                  const TargetData &TD, unsigned Depth) {
   assert(V->getType()->isIntegerTy() && "Not an integer value");
 
   // Limit our recursion depth.
@@ -236,7 +236,7 @@
       case Instruction::Or:
         // X|C == X+C if all the bits in C are unset in X.  Otherwise we can't
         // analyze it.
-        if (!MaskedValueIsZero(BOp->getOperand(0), RHSC->getValue(), TD))
+        if (!MaskedValueIsZero(BOp->getOperand(0), RHSC->getValue(), &TD))
           break;
         // FALL THROUGH.
       case Instruction::Add:
@@ -328,7 +328,7 @@
     // If we are lacking TargetData information, we can't compute the offets of
     // elements computed by GEPs.  However, we can handle bitcast equivalent
     // GEPs.
-    if (!TD) {
+    if (TD == 0) {
       if (!GEPOp->hasAllZeroIndices())
         return V;
       V = GEPOp->getOperand(0);
@@ -363,7 +363,7 @@
       // Use GetLinearExpression to decompose the index into a C1*V+C2 form.
       unsigned Width = cast<IntegerType>(Index->getType())->getBitWidth();
       APInt IndexScale(Width, 0), IndexOffset(Width, 0);
-      Index = GetLinearExpression(Index, IndexScale, IndexOffset, TD, 0);
+      Index = GetLinearExpression(Index, IndexScale, IndexOffset, *TD, 0);
       
       // The GEP index scale ("Scale") scales C1*V+C2, yielding (C1*V+C2)*Scale.
       // This gives us an aggregate computation of (C1*Scale)*V + C2*Scale.





More information about the llvm-commits mailing list