Skip to content

Commit 6bb7c65

Browse files
committed
[MLIR][OpenMP] Add check to see if map operand is of PtrType before creating LoadInst
This fixes build error from fbaf2c6.
1 parent caa124b commit 6bb7c65

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2296,7 +2296,11 @@ createAlteredByCaptureMap(MapInfoData &mapData,
22962296
} break;
22972297
case mlir::omp::VariableCaptureKind::ByCopy: {
22982298
llvm::Type *type = mapData.BaseType[i];
2299-
llvm::Value *newV = builder.CreateLoad(type, mapData.Pointers[i]);
2299+
llvm::Value *newV;
2300+
if (mapData.Pointers[i]->getType()->isPointerTy())
2301+
newV = builder.CreateLoad(type, mapData.Pointers[i]);
2302+
else
2303+
newV = mapData.Pointers[i];
23002304

23012305
if (!type->isPointerTy()) {
23022306
auto curInsert = builder.saveIP();

0 commit comments

Comments
 (0)