[RuntimeDebugBuilder] Remove pointer element type accesses
authorNikita Popov <npopov@redhat.com>
Wed, 30 Mar 2022 12:00:24 +0000 (14:00 +0200)
committerNikita Popov <npopov@redhat.com>
Wed, 30 Mar 2022 12:02:41 +0000 (14:02 +0200)
polly/lib/CodeGen/RuntimeDebugBuilder.cpp

index 05e47e1..680a7ff 100644 (file)
@@ -132,8 +132,7 @@ prepareValuesForPrinting(PollyIRBuilder &Builder, ArrayRef<Value *> Values) {
         assert(Ty->getIntegerBitWidth() &&
                "Integer types larger 64 bit not supported");
     } else if (isa<PointerType>(Ty)) {
-      if (Ty->getPointerElementType() == Builder.getInt8Ty() &&
-          Ty->getPointerAddressSpace() == 4) {
+      if (Ty == Builder.getInt8PtrTy(4)) {
         Val = Builder.CreateGEP(Builder.getInt8Ty(), Val, Builder.getInt64(0));
       } else {
         Val = Builder.CreatePtrToInt(Val, Builder.getInt64Ty());
@@ -207,11 +206,10 @@ void RuntimeDebugBuilder::createGPUPrinterT(PollyIRBuilder &Builder,
                "Integer types larger 64 bit not supported");
         // fallthrough
       }
-    } else if (auto PtTy = dyn_cast<PointerType>(Ty)) {
-      if (PtTy->getAddressSpace() == 4) {
+    } else if (isa<PointerType>(Ty)) {
+      if (Ty == Builder.getInt8PtrTy(4)) {
         // Pointers in constant address space are printed as strings
-        Val = Builder.CreateGEP(Ty->getPointerElementType(), Val,
-                                Builder.getInt64(0));
+        Val = Builder.CreateGEP(Builder.getInt8Ty(), Val, Builder.getInt64(0));
         auto F = RuntimeDebugBuilder::getAddressSpaceCast(Builder, 4, 0);
         Val = Builder.CreateCall(F, Val);
       } else {