Skip to content

Commit 0e2022d

Browse files
fda0igcbot
authored andcommitted
Legacy inliner llvm patch
Introduce llvm patch that builds upon commit: llvm/llvm-project@88da019 Original commit diagnosed an issue in the legacy inliner and claimed to fix it but the change was non-functional and only added a debug mode assert. This patch modifies it to mitigate the problem in the cases where the assert would happen.
1 parent e053866 commit 0e2022d

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*========================== begin_copyright_notice ============================
2+
3+
Copyright (C) 2025 Intel Corporation
4+
5+
SPDX-License-Identifier: MIT
6+
7+
============================= end_copyright_notice ===========================*/
8+
9+
This patch builds upon changes introduced in commit:
10+
https://github.com/llvm/llvm-project/commit/88da01997725f4ff1587d8944540986c42d47bf6
11+
12+
Original commit diagnosed an issue in the legacy inliner and claimed to fix it
13+
but the change was non-functional and only added a debug mode assert.
14+
This patch modifies it to mitigate the problem in the cases where
15+
the assert would happen.
16+
17+
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp
18+
index 5bcfc38c5..e7ab62d0d 100644
19+
--- a/llvm/lib/Transforms/IPO/Inliner.cpp
20+
+++ b/llvm/lib/Transforms/IPO/Inliner.cpp
21+
@@ -533,7 +533,6 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG,
22+
int NewHistoryID = InlineHistory.size();
23+
InlineHistory.push_back(std::make_pair(Callee, InlineHistoryID));
24+
25+
-#ifndef NDEBUG
26+
// Make sure no dupplicates in the inline candidates. This could
27+
// happen when a callsite is simpilfied to reusing the return value
28+
// of another callsite during function cloning, thus the other
29+
@@ -541,14 +540,11 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG,
30+
DenseSet<CallBase *> DbgCallSites;
31+
for (auto &II : CallSites)
32+
DbgCallSites.insert(II.first);
33+
-#endif
34+
35+
for (Value *Ptr : InlineInfo.InlinedCalls) {
36+
-#ifndef NDEBUG
37+
- assert(DbgCallSites.count(dyn_cast<CallBase>(Ptr)) == 0);
38+
-#endif
39+
- CallSites.push_back(
40+
- std::make_pair(dyn_cast<CallBase>(Ptr), NewHistoryID));
41+
+ if (DbgCallSites.count(dyn_cast<CallBase>(Ptr)) == 0)
42+
+ CallSites.push_back(
43+
+ std::make_pair(dyn_cast<CallBase>(Ptr), NewHistoryID));
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)