[polly] a3ef858 - [mlir,polly] Replace uses of IRBuilder::getInt8PtrTy with getPtrTy. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 20:58:30 PST 2023


Author: Fangrui Song
Date: 2023-11-27T20:58:25-08:00
New Revision: a3ef858968d3a7c4da03cd9126a2909dbd64c1d4

URL: https://github.com/llvm/llvm-project/commit/a3ef858968d3a7c4da03cd9126a2909dbd64c1d4
DIFF: https://github.com/llvm/llvm-project/commit/a3ef858968d3a7c4da03cd9126a2909dbd64c1d4.diff

LOG: [mlir,polly] Replace uses of IRBuilder::getInt8PtrTy with getPtrTy. NFC

Added: 
    

Modified: 
    mlir/lib/ExecutionEngine/ExecutionEngine.cpp
    mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    polly/lib/CodeGen/LoopGeneratorsGOMP.cpp
    polly/lib/CodeGen/LoopGeneratorsKMP.cpp
    polly/lib/CodeGen/PerfMonitor.cpp
    polly/lib/CodeGen/RuntimeDebugBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
index dbcc0ba6fc99c67..267ec236d3fd590 100644
--- a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -175,9 +175,8 @@ static void packFunctionArguments(Module *module) {
       llvm::Value *argIndex = llvm::Constant::getIntegerValue(
           builder.getInt64Ty(), APInt(64, index));
       llvm::Value *argPtrPtr =
-          builder.CreateGEP(builder.getInt8PtrTy(), argList, argIndex);
-      llvm::Value *argPtr =
-          builder.CreateLoad(builder.getInt8PtrTy(), argPtrPtr);
+          builder.CreateGEP(builder.getPtrTy(), argList, argIndex);
+      llvm::Value *argPtr = builder.CreateLoad(builder.getPtrTy(), argPtrPtr);
       llvm::Type *argTy = arg.getType();
       llvm::Value *load = builder.CreateLoad(argTy, argPtr);
       args.push_back(load);
@@ -191,9 +190,8 @@ static void packFunctionArguments(Module *module) {
       llvm::Value *retIndex = llvm::Constant::getIntegerValue(
           builder.getInt64Ty(), APInt(64, llvm::size(func.args())));
       llvm::Value *retPtrPtr =
-          builder.CreateGEP(builder.getInt8PtrTy(), argList, retIndex);
-      llvm::Value *retPtr =
-          builder.CreateLoad(builder.getInt8PtrTy(), retPtrPtr);
+          builder.CreateGEP(builder.getPtrTy(), argList, retIndex);
+      llvm::Value *retPtr = builder.CreateLoad(builder.getPtrTy(), retPtrPtr);
       builder.CreateStore(result, retPtr);
     }
 

diff  --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index 48a78eddfbf97d3..4f6200d29a70a64 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -2286,11 +2286,11 @@ createAlteredByCaptureMap(MapInfoData &mapData,
           auto curInsert = builder.saveIP();
           builder.restoreIP(findAllocaInsertPoint(builder, moduleTranslation));
           auto *memTempAlloc =
-              builder.CreateAlloca(builder.getInt8PtrTy(), nullptr, ".casted");
+              builder.CreateAlloca(builder.getPtrTy(), nullptr, ".casted");
           builder.restoreIP(curInsert);
 
           builder.CreateStore(newV, memTempAlloc);
-          newV = builder.CreateLoad(builder.getInt8PtrTy(), memTempAlloc);
+          newV = builder.CreateLoad(builder.getPtrTy(), memTempAlloc);
         }
 
         mapData.Pointers[i] = newV;

diff  --git a/polly/lib/CodeGen/LoopGeneratorsGOMP.cpp b/polly/lib/CodeGen/LoopGeneratorsGOMP.cpp
index 254c5e973f66417..e7512c1f33f6102 100644
--- a/polly/lib/CodeGen/LoopGeneratorsGOMP.cpp
+++ b/polly/lib/CodeGen/LoopGeneratorsGOMP.cpp
@@ -30,8 +30,8 @@ void ParallelLoopGeneratorGOMP::createCallSpawnThreads(Value *SubFn,
     GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
 
     Type *Params[] = {PointerType::getUnqual(FunctionType::get(
-                          Builder.getVoidTy(), Builder.getInt8PtrTy(), false)),
-                      Builder.getInt8PtrTy(),
+                          Builder.getVoidTy(), Builder.getPtrTy(), false)),
+                      Builder.getPtrTy(),
                       Builder.getInt32Ty(),
                       LongType,
                       LongType,
@@ -61,7 +61,7 @@ void ParallelLoopGeneratorGOMP::deployParallelExecution(Function *SubFn,
 
 Function *ParallelLoopGeneratorGOMP::prepareSubFnDefinition(Function *F) const {
   FunctionType *FT =
-      FunctionType::get(Builder.getVoidTy(), {Builder.getInt8PtrTy()}, false);
+      FunctionType::get(Builder.getVoidTy(), {Builder.getPtrTy()}, false);
   Function *SubFn = Function::Create(FT, Function::InternalLinkage,
                                      F->getName() + "_polly_subfn", M);
   // Name the function's arguments

diff  --git a/polly/lib/CodeGen/LoopGeneratorsKMP.cpp b/polly/lib/CodeGen/LoopGeneratorsKMP.cpp
index 5bcfa664c11b6a9..b3af7b14f478082 100644
--- a/polly/lib/CodeGen/LoopGeneratorsKMP.cpp
+++ b/polly/lib/CodeGen/LoopGeneratorsKMP.cpp
@@ -81,7 +81,7 @@ Function *ParallelLoopGeneratorKMP::prepareSubFnDefinition(Function *F) const {
                                    LongType,
                                    LongType,
                                    LongType,
-                                   Builder.getInt8PtrTy()};
+                                   Builder.getPtrTy()};
 
   FunctionType *FT = FunctionType::get(Builder.getVoidTy(), Arguments, false);
   Function *SubFn = Function::Create(FT, Function::InternalLinkage,
@@ -512,7 +512,7 @@ GlobalVariable *ParallelLoopGeneratorKMP::createSourceLocation() {
     if (!IdentTy) {
       Type *LocMembers[] = {Builder.getInt32Ty(), Builder.getInt32Ty(),
                             Builder.getInt32Ty(), Builder.getInt32Ty(),
-                            Builder.getInt8PtrTy()};
+                            Builder.getPtrTy()};
 
       IdentTy =
           StructType::create(M->getContext(), LocMembers, StructName, false);

diff  --git a/polly/lib/CodeGen/PerfMonitor.cpp b/polly/lib/CodeGen/PerfMonitor.cpp
index 8ffcb646d73fe54..056d5b372723b05 100644
--- a/polly/lib/CodeGen/PerfMonitor.cpp
+++ b/polly/lib/CodeGen/PerfMonitor.cpp
@@ -24,8 +24,8 @@ Function *PerfMonitor::getAtExit() {
 
   if (!F) {
     GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
-    FunctionType *Ty = FunctionType::get(Builder.getInt32Ty(),
-                                         {Builder.getInt8PtrTy()}, false);
+    FunctionType *Ty =
+        FunctionType::get(Builder.getInt32Ty(), {Builder.getPtrTy()}, false);
     F = Function::Create(Ty, Linkage, Name, M);
   }
 
@@ -44,12 +44,12 @@ void PerfMonitor::addToGlobalConstructors(Function *Fn) {
     GV->eraseFromParent();
   }
 
-  StructType *ST = StructType::get(Builder.getInt32Ty(), Fn->getType(),
-                                   Builder.getInt8PtrTy());
+  StructType *ST =
+      StructType::get(Builder.getInt32Ty(), Fn->getType(), Builder.getPtrTy());
 
   V.push_back(
       ConstantStruct::get(ST, Builder.getInt32(10), Fn,
-                          ConstantPointerNull::get(Builder.getInt8PtrTy())));
+                          ConstantPointerNull::get(Builder.getPtrTy())));
   ArrayType *Ty = ArrayType::get(ST, V.size());
 
   GV = new GlobalVariable(*M, Ty, true, GlobalValue::AppendingLinkage,
@@ -246,7 +246,7 @@ Function *PerfMonitor::insertInitFunction(Function *FinalReporting) {
 
   // Register the final reporting function with atexit().
   Value *FinalReportingPtr =
-      Builder.CreatePointerCast(FinalReporting, Builder.getInt8PtrTy());
+      Builder.CreatePointerCast(FinalReporting, Builder.getPtrTy());
   Function *AtExitFn = getAtExit();
   Builder.CreateCall(AtExitFn, {FinalReportingPtr});
 

diff  --git a/polly/lib/CodeGen/RuntimeDebugBuilder.cpp b/polly/lib/CodeGen/RuntimeDebugBuilder.cpp
index fe30924c0286290..8a29b0aaaf9c365 100644
--- a/polly/lib/CodeGen/RuntimeDebugBuilder.cpp
+++ b/polly/lib/CodeGen/RuntimeDebugBuilder.cpp
@@ -34,8 +34,7 @@ Function *RuntimeDebugBuilder::getVPrintF(PollyIRBuilder &Builder) {
   if (!F) {
     GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
     FunctionType *Ty = FunctionType::get(
-        Builder.getInt32Ty(), {Builder.getInt8PtrTy(), Builder.getInt8PtrTy()},
-        false);
+        Builder.getInt32Ty(), {Builder.getPtrTy(), Builder.getPtrTy()}, false);
     F = Function::Create(Ty, Linkage, Name, M);
   }
 
@@ -78,7 +77,7 @@ prepareValuesForPrinting(PollyIRBuilder &Builder, ArrayRef<Value *> Values) {
         assert(Ty->getIntegerBitWidth() &&
                "Integer types larger 64 bit not supported");
     } else if (isa<PointerType>(Ty)) {
-      if (Ty == Builder.getInt8PtrTy(4)) {
+      if (Ty == Builder.getPtrTy(4)) {
         Val = Builder.CreateGEP(Builder.getInt8Ty(), Val, Builder.getInt64(0));
       } else {
         Val = Builder.CreatePtrToInt(Val, Builder.getInt64Ty());
@@ -148,7 +147,7 @@ void RuntimeDebugBuilder::createFlush(PollyIRBuilder &Builder) {
   if (!F) {
     GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
     FunctionType *Ty =
-        FunctionType::get(Builder.getInt32Ty(), Builder.getInt8PtrTy(), false);
+        FunctionType::get(Builder.getInt32Ty(), Builder.getPtrTy(), false);
     F = Function::Create(Ty, Linkage, Name, M);
   }
 


        


More information about the llvm-commits mailing list