[PATCH] D86630: [ArgumentPromotion]: Copy function metadata after promoting arguments
Ettore Tiotto via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 10:10:17 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6b13cfe7399b: [ArgumentPromotion]: Copy function metadata after promoting arguments (authored by etiotto).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86630/new/
https://reviews.llvm.org/D86630
Files:
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/test/Transforms/ArgumentPromotion/profile.ll
Index: llvm/test/Transforms/ArgumentPromotion/profile.ll
===================================================================
--- llvm/test/Transforms/ArgumentPromotion/profile.ll
+++ llvm/test/Transforms/ArgumentPromotion/profile.ll
@@ -15,9 +15,9 @@
ret void
}
-define internal void @promote_i32_ptr(i32* %xp) {
+define internal void @promote_i32_ptr(i32* %xp) !prof !1 {
; CHECK-LABEL: define {{[^@]+}}@promote_i32_ptr
-; CHECK-SAME: (i32 [[XP_VAL:%.*]])
+; CHECK-SAME: (i32 [[XP_VAL:%.*]]) !prof !1
; CHECK-NEXT: call void @use_i32(i32 [[XP_VAL]])
; CHECK-NEXT: ret void
;
@@ -29,3 +29,4 @@
declare void @use_i32(i32)
!0 = !{!"branch_weights", i32 30}
+!1 = !{!"function_entry_count", i64 100}
Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
===================================================================
--- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -215,9 +215,11 @@
Function *NF = Function::Create(NFTy, F->getLinkage(), F->getAddressSpace(),
F->getName());
NF->copyAttributesFrom(F);
+ NF->copyMetadata(F, 0);
- // Patch the pointer to LLVM function in debug info descriptor.
- NF->setSubprogram(F->getSubprogram());
+ // The new function will have the !dbg metadata copied from the original
+ // function. The original function may not be deleted, and dbg metadata need
+ // to be unique so we need to drop it.
F->setSubprogram(nullptr);
LLVM_DEBUG(dbgs() << "ARG PROMOTION: Promoting to:" << *NF << "\n"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86630.291014.patch
Type: text/x-patch
Size: 1558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200910/e7e5ae52/attachment.bin>
More information about the llvm-commits
mailing list