Skip to content

Commit 6bdeb53

Browse files
authored
[MLIR][OpenMP] Fix the assertion failure for VariableCaptureKind::ByCopy (#72424)
1 parent f1d7738 commit 6bdeb53

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

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

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,32 +2197,19 @@ createDeviceArgumentAccessor(MapInfoData &mapData, llvm::Argument &arg,
21972197
ompBuilder.M.getDataLayout().getProgramAddressSpace();
21982198

21992199
// Create the alloca for the argument the current point.
2200-
llvm::Value *v =
2201-
builder.CreateAlloca(arg.getType()->isPointerTy()
2202-
? arg.getType()
2203-
: llvm::Type::getInt64Ty(builder.getContext()),
2204-
ompBuilder.M.getDataLayout().getAllocaAddrSpace());
2200+
llvm::Value *v = builder.CreateAlloca(arg.getType(), allocaAS);
22052201

2206-
if (allocaAS != defaultAS && arg.getType()->isPointerTy()) {
2202+
if (allocaAS != defaultAS && arg.getType()->isPointerTy())
22072203
v = builder.CreatePointerBitCastOrAddrSpaceCast(
22082204
v, arg.getType()->getPointerTo(defaultAS));
2209-
}
22102205

22112206
builder.CreateStore(&arg, v);
22122207

22132208
builder.restoreIP(codeGenIP);
22142209

22152210
switch (capture) {
22162211
case mlir::omp::VariableCaptureKind::ByCopy: {
2217-
// RHS of || aims to ignore conversions like int -> uint, but further
2218-
// extension of this path must be implemented for the moment it'll fall
2219-
// through to the assert.
2220-
if (inputType->isPointerTy() || v->getType() == inputType->getPointerTo()) {
2221-
retVal = v;
2222-
return builder.saveIP();
2223-
}
2224-
2225-
assert(false && "Currently unsupported OMPTargetVarCaptureByCopy Type");
2212+
retVal = v;
22262213
break;
22272214
}
22282215
case mlir::omp::VariableCaptureKind::ByRef: {

0 commit comments

Comments
 (0)