[Mlir-commits] [mlir] [mlir] fix a segment fault in `ConversionPatternRewriter::applySignatureConversion` (PR #82530)

Chao Chen llvmlistbot at llvm.org
Wed Feb 21 14:06:12 PST 2024


https://github.com/chencha3 updated https://github.com/llvm/llvm-project/pull/82530

>From 30ba1d56c713b3d56a6ebee2424eeb9764c58e69 Mon Sep 17 00:00:00 2001
From: Chao Chen <chao.chen at intel.com>
Date: Wed, 21 Feb 2024 14:14:02 -0600
Subject: [PATCH 1/2] fix a segment fault

---
 mlir/lib/Transforms/Utils/DialectConversion.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 4989ddc3ec94fb..b5cc8ca223d1af 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -642,8 +642,11 @@ Block *ArgConverter::applySignatureConversion(
 
       // Legalize the argument output type.
       Type outputType = origOutputType;
-      if (Type legalOutputType = converter->convertType(outputType))
-        outputType = legalOutputType;
+      if (converter){
+        if (Type legalOutputType = converter->convertType(outputType))
+          outputType = legalOutputType;
+      }
+        
 
       newArg = buildUnresolvedArgumentMaterialization(
           rewriter, origArg.getLoc(), replArgs, origOutputType, outputType,

>From e42cd2f37056e3e9abf437438644cf23240c9723 Mon Sep 17 00:00:00 2001
From: Chao Chen <chao.chen at intel.com>
Date: Wed, 21 Feb 2024 16:05:58 -0600
Subject: [PATCH 2/2] run code formatter

---
 mlir/lib/Transforms/Utils/DialectConversion.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index b5cc8ca223d1af..84eb352cc7ae8c 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -642,11 +642,10 @@ Block *ArgConverter::applySignatureConversion(
 
       // Legalize the argument output type.
       Type outputType = origOutputType;
-      if (converter){
+      if (converter) {
         if (Type legalOutputType = converter->convertType(outputType))
           outputType = legalOutputType;
       }
-        
 
       newArg = buildUnresolvedArgumentMaterialization(
           rewriter, origArg.getLoc(), replArgs, origOutputType, outputType,



More information about the Mlir-commits mailing list