Skip to content

Commit 9500f42

Browse files
author
Yonghong Song
committed
[Transforms][IPO] Add func suffix in ArgumentPromotion and DeadArgumentElimination
ArgumentPromotion and DeadArgumentElimination passes could change function signatures but the function name remains the same as before the transformation. This makes it hard for tracing with bpf programs where user tends to use function signature in the source. See discussion [1] for details. This patch added suffix to functions whose signatures are changed. The suffix lets users know that function signature has changed and they need to impact the IR or binary to find modified signature before tracing those functions. The suffix for ArgumentPromotion is ".argpromotion" and the suffix for DeadArgumentElimination is ".deadargelim". The suffix also gives user hints about what kind of transformation has been done. With this patch, I built a recent linux kernel with full LTO enabled. I got 4 functions with only argpromotion like set_track_update.deadargelim.argpromotion pmd_trans_huge_lock.argpromotion ... I got 1058 functions with only deadargelim like process_bit0.deadargelim pci_io_ecs_init.deadargelim ... I got 3 functions with both argpromotion and deadargelim set_track_update.deadargelim.argpromotion zero_pud_populate.deadargelim.argpromotion zero_pmd_populate.deadargelim.argpromotion [1] #104678
1 parent 172c4a4 commit 9500f42

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

llvm/lib/Transforms/IPO/ArgumentPromotion.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ doPromotion(Function *F, FunctionAnalysisManager &FAM,
200200

201201
F->getParent()->getFunctionList().insert(F->getIterator(), NF);
202202
NF->takeName(F);
203+
NF->setName(NF->getName() + ".argpromotion");
203204

204205
// Loop over all the callers of the function, transforming the call sites to
205206
// pass in the loaded pointers.

llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,7 @@ bool DeadArgumentEliminationPass::removeDeadStuffFromFunction(Function *F) {
876876
// it again.
877877
F->getParent()->getFunctionList().insert(F->getIterator(), NF);
878878
NF->takeName(F);
879+
NF->setName(NF->getName() + ".deadargelim");
879880
NF->IsNewDbgInfoFormat = F->IsNewDbgInfoFormat;
880881

881882
// Loop over all the callers of the function, transforming the call sites to

0 commit comments

Comments
 (0)