Skip to content

Commit a6230b2

Browse files
committed
Fix compile failure
1 parent 820c957 commit a6230b2

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,15 +2030,13 @@ llvm::omp::OMPTgtExecModeFlags
20302030
TargetOp::getKernelExecFlags(Operation *capturedOp) {
20312031
using namespace llvm::omp;
20322032

2033-
#ifndef NDEBUG
2034-
if (capturedOp) {
2035-
// A non-null captured op is only valid if it resides inside of a TargetOp
2036-
// and is the result of calling getInnermostCapturedOmpOp() on it.
2037-
TargetOp targetOp = capturedOp->getParentOfType<TargetOp>();
2038-
assert(targetOp && targetOp.getInnermostCapturedOmpOp() &&
2039-
"unexpected captured op");
2040-
}
2041-
#endif
2033+
// A non-null captured op is only valid if it resides inside of a TargetOp
2034+
// and is the result of calling getInnermostCapturedOmpOp() on it.
2035+
TargetOp targetOp =
2036+
capturedOp ? capturedOp->getParentOfType<TargetOp>() : nullptr;
2037+
assert((!capturedOp ||
2038+
(targetOp && targetOp.getInnermostCapturedOmpOp() == capturedOp)) &&
2039+
"unexpected captured op");
20422040

20432041
// Make sure this region is capturing a loop. Otherwise, it's a generic
20442042
// kernel.
@@ -2065,7 +2063,7 @@ TargetOp::getKernelExecFlags(Operation *capturedOp) {
20652063
if (!isa_and_present<TeamsOp>(teamsOp))
20662064
return OMP_TGT_EXEC_MODE_GENERIC;
20672065

2068-
if (teamsOp->getParentOp() == *this)
2066+
if (teamsOp->getParentOp() == targetOp.getOperation())
20692067
return OMP_TGT_EXEC_MODE_GENERIC_SPMD;
20702068
}
20712069

@@ -2086,7 +2084,7 @@ TargetOp::getKernelExecFlags(Operation *capturedOp) {
20862084
if (!isa_and_present<TeamsOp>(teamsOp))
20872085
return OMP_TGT_EXEC_MODE_GENERIC;
20882086

2089-
if (teamsOp->getParentOp() == *this)
2087+
if (teamsOp->getParentOp() == targetOp.getOperation())
20902088
return OMP_TGT_EXEC_MODE_SPMD;
20912089
}
20922090

0 commit comments

Comments
 (0)