Make NaryReassociate pass the address space to isLegalAddressingMode
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Sun, 7 Jun 2015 20:17:42 +0000 (20:17 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Sun, 7 Jun 2015 20:17:42 +0000 (20:17 +0000)
No test since the kinds of transforms this prevents seem to not really
be relevant for SI's different addressing modes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239261 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/NaryReassociate.cpp

index 6ac5ff85e32cef855520c39ae66be431dc95eefd..4cf68b00da0a724b6825d29994ef421c232463cd 100644 (file)
@@ -317,8 +317,10 @@ static bool isGEPFoldable(GetElementPtrInst *GEP,
       BaseOffset += DL->getStructLayout(STy)->getElementOffset(Field);
     }
   }
+
+  unsigned AddrSpace = GEP->getPointerAddressSpace();
   return TTI->isLegalAddressingMode(GEP->getType()->getElementType(), BaseGV,
-                                    BaseOffset, HasBaseReg, Scale);
+                                    BaseOffset, HasBaseReg, Scale, AddrSpace);
 }
 
 Instruction *NaryReassociate::tryReassociateGEP(GetElementPtrInst *GEP) {