Skip to content

[mlir][inliner] Assert that no external nodes passed to the profitability hook. #85489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

vzakhari
Copy link
Contributor

Fixes #85400

@vzakhari vzakhari requested a review from joker-eph March 16, 2024 00:37
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels Mar 16, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 16, 2024

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-core

Author: Slava Zakharin (vzakhari)

Changes

Fixes #85400


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

1 Files Affected:

  • (modified) mlir/lib/Transforms/InlinerPass.cpp (+1-4)
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;

Copy link

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link

✅ With the latest revision this PR passed the Python code formatter.

@vzakhari vzakhari merged commit 133156c into llvm:main Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:core MLIR Core Infrastructure mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mlir/lib/Transforms/InlinerPass.cpp:101: Suspicious condition ?
2 participants