[Mlir-commits] [mlir] e992280 - [MLIR] Fix empty optional access in DialectConversion (#168331)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Nov 17 02:18:37 PST 2025


Author: Vadim Curcă
Date: 2025-11-17T11:18:34+01:00
New Revision: e992280f9d5ba91d772c26446e1107c7a1793f78

URL: https://github.com/llvm/llvm-project/commit/e992280f9d5ba91d772c26446e1107c7a1793f78
DIFF: https://github.com/llvm/llvm-project/commit/e992280f9d5ba91d772c26446e1107c7a1793f78.diff

LOG: [MLIR] Fix empty optional access in DialectConversion (#168331)

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.

Added: 
    

Modified: 
    mlir/lib/Transforms/Utils/DialectConversion.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 365bfddeaab73..27e3ec6f64c8f 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -2766,7 +2766,7 @@ LogicalResult OperationLegalizer::legalizeWithPattern(Operation *op) {
       rewriterImpl.patternMaterializations.clear();
 #if MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS
       // Expensive pattern check that can detect API violations.
-      if (checkOp) {
+      if (checkOp && topLevelFingerPrint) {
         OperationFingerPrint fingerPrintAfterPattern(checkOp);
         if (fingerPrintAfterPattern != *topLevelFingerPrint)
           llvm::report_fatal_error("pattern '" + pattern.getDebugName() +


        


More information about the Mlir-commits mailing list