[Mlir-commits] [mlir] 6bb7c65 - [MLIR][OpenMP] Add check to see if map operand is of PtrType before creating LoadInst

Akash Banerjee llvmlistbot at llvm.org
Tue Nov 7 05:26:35 PST 2023


Author: Akash Banerjee
Date: 2023-11-07T13:26:27Z
New Revision: 6bb7c65493925e0fd1ec5d9645a840b9bd10aede

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

LOG: [MLIR][OpenMP] Add check to see if map operand is of PtrType before creating LoadInst

This fixes build error from fbaf2c6cf7b207145dbda0d1cbadd0b446a21199.

Added: 
    

Modified: 
    mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index e6eacaed1522877..d9ab785a082835d 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -2296,7 +2296,11 @@ createAlteredByCaptureMap(MapInfoData &mapData,
       } break;
       case mlir::omp::VariableCaptureKind::ByCopy: {
         llvm::Type *type = mapData.BaseType[i];
-        llvm::Value *newV = builder.CreateLoad(type, mapData.Pointers[i]);
+        llvm::Value *newV;
+        if (mapData.Pointers[i]->getType()->isPointerTy())
+          newV = builder.CreateLoad(type, mapData.Pointers[i]);
+        else
+          newV = mapData.Pointers[i];
 
         if (!type->isPointerTy()) {
           auto curInsert = builder.saveIP();


        


More information about the Mlir-commits mailing list