Change stack probing code for MingW.
[oota-llvm.git] / lib / Analysis / BasicAliasAnalysis.cpp
index 4e423a787c97b20a417e0c2534b1a9ce36d15529..b2c20110e90e731982a5fcd8c8419c28ecb3b234 100644 (file)
@@ -326,6 +326,7 @@ DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
       continue;
     }
 
+    unsigned AS = GEPOp->getPointerAddressSpace();
     // Walk the indices of the GEP, accumulating them into BaseOff/VarIndices.
     gep_type_iterator GTI = gep_type_begin(GEPOp);
     for (User::const_op_iterator I = GEPOp->op_begin()+1,
@@ -354,7 +355,7 @@ DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
       // If the integer type is smaller than the pointer size, it is implicitly
       // sign extended to pointer size.
       unsigned Width = Index->getType()->getIntegerBitWidth();
-      if (TD->getPointerSizeInBits() > Width)
+      if (TD->getPointerSizeInBits(AS) > Width)
         Extension = EK_SignExt;
 
       // Use GetLinearExpression to decompose the index into a C1*V+C2 form.
@@ -382,7 +383,7 @@ DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
 
       // Make sure that we have a scale that makes sense for this target's
       // pointer size.
-      if (unsigned ShiftBits = 64-TD->getPointerSizeInBits()) {
+      if (unsigned ShiftBits = 64 - TD->getPointerSizeInBits(AS)) {
         Scale <<= ShiftBits;
         Scale = (int64_t)Scale >> ShiftBits;
       }
@@ -1238,17 +1239,6 @@ BasicAliasAnalysis::aliasCheck(const Value *V1, uint64_t V1Size,
       return NoAlias;
     if (isEscapeSource(O2) && isNonEscapingLocalObject(O1))
       return NoAlias;
-
-    // If one object is a global variable without address taken, the other one
-    // is a different object, they will not alias because the global variable
-    // in question cannot be indirectly accessed.
-    if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(O1))
-      if (!GV->AddressMaybeTaken())
-        return NoAlias;
-
-    if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(O2))
-      if (!GV->AddressMaybeTaken())
-        return NoAlias;
   }
 
   // If the size of one access is larger than the entire object on the other