Skip to content

Commit 2f5477d

Browse files
committed
[MLIR][OpenMP] Add check for appropriate module operation during convertFlagsAttr
Checks if the operation the attirbute resides on is an ModuleOp otherwise it fails.
1 parent 843450b commit 2f5477d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,6 +1547,9 @@ convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder,
15471547
/// be passed as flags to the frontend, otherwise they are set to default
15481548
LogicalResult convertFlagsAttr(Operation *op, mlir::omp::FlagsAttr attribute,
15491549
LLVM::ModuleTranslation &moduleTranslation) {
1550+
if (!cast<mlir::ModuleOp>(op))
1551+
return failure();
1552+
15501553
llvm::OpenMPIRBuilder *ompBuilder = moduleTranslation.getOpenMPBuilder();
15511554

15521555
ompBuilder->createGlobalFlag(

0 commit comments

Comments
 (0)