Skip to content

Commit 3f19fcc

Browse files
committed
[MLIR] Fix empty optional access in DialectConversion
When both `MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS` and MLIR multithreading are enabled, `topLevelFingerPrint` is empty but its value is accessed. This adds a `has_value()` check before dereferencing the optional.
1 parent 51c8180 commit 3f19fcc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mlir/lib/Transforms/Utils/DialectConversion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2766,7 +2766,7 @@ LogicalResult OperationLegalizer::legalizeWithPattern(Operation *op) {
27662766
rewriterImpl.patternMaterializations.clear();
27672767
#if MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS
27682768
// Expensive pattern check that can detect API violations.
2769-
if (checkOp) {
2769+
if (checkOp && topLevelFingerPrint) {
27702770
OperationFingerPrint fingerPrintAfterPattern(checkOp);
27712771
if (fingerPrintAfterPattern != *topLevelFingerPrint)
27722772
llvm::report_fatal_error("pattern '" + pattern.getDebugName() +

0 commit comments

Comments
 (0)