[Mlir-commits] [mlir] [mlir][inliner] Assert that no external nodes passed to the profitability hook. (PR #85489)

Slava Zakharin llvmlistbot at llvm.org
Fri Mar 15 17:37:36 PDT 2024


https://github.com/vzakhari created https://github.com/llvm/llvm-project/pull/85489

Fixes #85400

>From 140fa83c483511cdbe0381f19a9894c9e2122e62 Mon Sep 17 00:00:00 2001
From: Slava Zakharin <szakharin at nvidia.com>
Date: Fri, 15 Mar 2024 17:25:14 -0700
Subject: [PATCH] [mlir][inliner] Assert that no external nodes passed to the
 profitability hook.

Fixes #85400
---
 mlir/lib/Transforms/InlinerPass.cpp | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/mlir/lib/Transforms/InlinerPass.cpp b/mlir/lib/Transforms/InlinerPass.cpp
index 08d8dbf73a6a1d..2d40d29e1f6077 100644
--- a/mlir/lib/Transforms/InlinerPass.cpp
+++ b/mlir/lib/Transforms/InlinerPass.cpp
@@ -96,10 +96,7 @@ static bool isProfitableToInline(const Inliner::ResolvedCall &resolvedCall,
   Region *callerRegion = resolvedCall.sourceNode->getCallableRegion();
   Region *calleeRegion = resolvedCall.targetNode->getCallableRegion();
 
-  // We should not get external nodes here, but just return true
-  // for now to preserve the original behavior of the inliner pass.
-  if (!calleeRegion || !calleeRegion)
-    return true;
+  assert(calleeRegion && callerRegion && "unexpected external node");
 
   auto countOps = [](Region *region) {
     unsigned count = 0;



More information about the Mlir-commits mailing list