[llvm] [Inliner] Fix bugs for partial inlining with vector (PR #101481)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 05:34:07 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: None (joshua-arch1)

<details>
<summary>Changes</summary>

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.

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


1 Files Affected:

- (modified) llvm/lib/Transforms/IPO/PartialInlining.cpp (+2-2) 


``````````diff
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.

``````````

</details>


https://github.com/llvm/llvm-project/pull/101481


More information about the llvm-commits mailing list