[llvm] [Inliner] Fix bugs for partial inlining with vector (PR #101481)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 1 19:21:17 PDT 2024
https://github.com/joshua-arch1 updated https://github.com/llvm/llvm-project/pull/101481
>From a2f74c24c4a513b55f0aaac795d8d1c690b18f51 Mon Sep 17 00:00:00 2001
From: "Jun Sha (Joshua)" <cooper.joshua at linux.alibaba.com>
Date: Fri, 2 Aug 2024 10:22:13 +0800
Subject: [PATCH] [Inliner] Fix bugs for partial inlining with vector
In the cost model of partial inlining, cost for intrinsics
will be applied. However, some intrinsics for vector have
invalid cost, which is not allowed for partial inlining.
Instead of assertion, we directly do not do partial
inlining in this circumstance to avoid compiling errors.
---
llvm/lib/Transforms/IPO/PartialInlining.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Transforms/IPO/PartialInlining.cpp b/llvm/lib/Transforms/IPO/PartialInlining.cpp
index 3ca095e1520f3..effdb17370201 100644
--- a/llvm/lib/Transforms/IPO/PartialInlining.cpp
+++ b/llvm/lib/Transforms/IPO/PartialInlining.cpp
@@ -1308,8 +1308,8 @@ bool PartialInlinerImpl::tryPartialInline(FunctionCloner &Cloner) {
InstructionCost SizeCost = std::get<0>(OutliningCosts);
InstructionCost NonWeightedRcost = std::get<1>(OutliningCosts);
- assert(SizeCost.isValid() && NonWeightedRcost.isValid() &&
- "Expected valid costs");
+ if (!SizeCost.isValid() || !NonWeightedRcost.isValid())
+ return false;
// Only calculate RelativeToEntryFreq when we are doing single region
// outlining.
More information about the llvm-commits
mailing list