diff options
author | Jun Sha (Joshua) <cooper.joshua@linux.alibaba.com> | 2024-08-02 10:22:13 +0800 |
---|---|---|
committer | Jun Sha (Joshua) <cooper.joshua@linux.alibaba.com> | 2024-08-02 10:22:13 +0800 |
commit | a2f74c24c4a513b55f0aaac795d8d1c690b18f51 (patch) | |
tree | e25ccc5cf95c33506fee1074309954bd64b06b66 | |
parent | 2feb0586b75bae87bb6e053b502ec7739da37837 (diff) | |
download | llvm-users/joshua/partial-inline.zip llvm-users/joshua/partial-inline.tar.gz llvm-users/joshua/partial-inline.tar.bz2 |
[Inliner] Fix bugs for partial inlining with vectorusers/joshua/partial-inline
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.
-rw-r--r-- | llvm/lib/Transforms/IPO/PartialInlining.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/PartialInlining.cpp b/llvm/lib/Transforms/IPO/PartialInlining.cpp index 3ca095e..effdb17 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. |