[Mlir-commits] [llvm] [mlir] Add missing return on nullptr check (PR #92125)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue May 14 08:41:22 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Daniel Kuts (apach301)

<details>
<summary>Changes</summary>

Fixes #<!-- -->92123 

---
Full diff: https://github.com/llvm/llvm-project/pull/92125.diff


2 Files Affected:

- (modified) llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp (+3-1) 
- (modified) mlir/lib/Dialect/Transform/IR/TransformOps.cpp (+1-1) 


``````````diff
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
index 88d353e89a461..92347b7b58a12 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
@@ -3392,8 +3392,10 @@ static bool HandleUse(TreePattern &I, TreePatternNodePtr Pat,
   Record *Rec;
   if (Pat->isLeaf()) {
     DefInit *DI = dyn_cast<DefInit>(Pat->getLeafValue());
-    if (!DI)
+    if (!DI) {
       I.error("Input $" + Pat->getName() + " must be an identifier!");
+      return false;
+    }
     Rec = DI->getDef();
   } else {
     Rec = Pat->getOperator();
diff --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
index eb09f007fbca8..a6e4e340da407 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
@@ -654,7 +654,7 @@ LogicalResult transform::ApplyConversionPatternsOp::verify() {
       InFlightDiagnostic diag = emitOpError()
                                 << "expected default converter child op to "
                                    "implement TypeConverterBuilderOpInterface";
-      diag.attachNote(typeConverterOp->getLoc()) << "op without interface";
+      diag.attachNote(typeConverterRegion.front().front()->getLoc()) << "op without interface";
       return diag;
     }
     // Check default type converter type.

``````````

</details>


https://github.com/llvm/llvm-project/pull/92125


More information about the Mlir-commits mailing list