[llvm] [mlir] Add missing return on nullptr check (PR #92125)
Daniel Kuts via llvm-commits
llvm-commits at lists.llvm.org
Tue May 14 08:40:53 PDT 2024
https://github.com/apach301 updated https://github.com/llvm/llvm-project/pull/92125
>From 0c10430e892cb7fee57ddbd0359fc4252d3de400 Mon Sep 17 00:00:00 2001
From: Daniil Kutz <kutz at ispras.ru>
Date: Tue, 14 May 2024 16:58:19 +0300
Subject: [PATCH 1/2] Add missing return on nullptr check
---
llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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();
>From caed1d55fef527abe284715cf168bddaee298dc1 Mon Sep 17 00:00:00 2001
From: Daniil Kutz <kutz at ispras.ru>
Date: Tue, 14 May 2024 18:40:37 +0300
Subject: [PATCH 2/2] Fix null pointer dereference in error message
---
mlir/lib/Dialect/Transform/IR/TransformOps.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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.
More information about the llvm-commits
mailing list