[OpaquePtr] Remove uses of CreateGEP() without element type
Remove uses of to-be-deprecated API. In cases where the correct
element type was not immediately obvious to me, fall back to
explicit getPointerElementType().
GitOrigin-RevId: 2c68ecccc9ee1fb37eca318a9b3572813a137cd5
diff --git a/lib/CodeGen/IslExprBuilder.cpp b/lib/CodeGen/IslExprBuilder.cpp
index bd1a564..db6680e 100644
--- a/lib/CodeGen/IslExprBuilder.cpp
+++ b/lib/CodeGen/IslExprBuilder.cpp
@@ -334,7 +334,8 @@
IndexOp = createMul(IndexOp, DimSize, "polly.access.mul." + BaseName);
}
- Access = Builder.CreateGEP(Base, IndexOp, "polly.access." + BaseName);
+ Access = Builder.CreateGEP(SAI->getElementType(), Base, IndexOp,
+ "polly.access." + BaseName);
if (PollyDebugPrinting)
RuntimeDebugBuilder::createCPUPrinter(Builder, "\n");
diff --git a/lib/CodeGen/RuntimeDebugBuilder.cpp b/lib/CodeGen/RuntimeDebugBuilder.cpp
index d7d8348..05e47e1 100644
--- a/lib/CodeGen/RuntimeDebugBuilder.cpp
+++ b/lib/CodeGen/RuntimeDebugBuilder.cpp
@@ -134,7 +134,7 @@
} else if (isa<PointerType>(Ty)) {
if (Ty->getPointerElementType() == Builder.getInt8Ty() &&
Ty->getPointerAddressSpace() == 4) {
- Val = Builder.CreateGEP(Val, Builder.getInt64(0));
+ Val = Builder.CreateGEP(Builder.getInt8Ty(), Val, Builder.getInt64(0));
} else {
Val = Builder.CreatePtrToInt(Val, Builder.getInt64Ty());
}
@@ -192,7 +192,8 @@
int Offset = 0;
for (auto Val : ToPrint) {
- auto Ptr = Builder.CreateGEP(DataPtr, Builder.getInt64(Offset));
+ auto Ptr = Builder.CreateGEP(Builder.getInt32Ty(), DataPtr,
+ Builder.getInt64(Offset));
Type *Ty = Val->getType();
if (Ty->isFloatingPointTy()) {
@@ -209,7 +210,8 @@
} else if (auto PtTy = dyn_cast<PointerType>(Ty)) {
if (PtTy->getAddressSpace() == 4) {
// Pointers in constant address space are printed as strings
- Val = Builder.CreateGEP(Val, Builder.getInt64(0));
+ Val = Builder.CreateGEP(Ty->getPointerElementType(), Val,
+ Builder.getInt64(0));
auto F = RuntimeDebugBuilder::getAddressSpaceCast(Builder, 4, 0);
Val = Builder.CreateCall(F, Val);
} else {