[PATCH] D41337: [PartialInliner] Set attributes for new call instruction.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 17 16:30:25 PST 2017
fhahn created this revision.
fhahn added reviewers: efriedma, davide, davidxl.
Herald added a subscriber: eraman.
https://reviews.llvm.org/D41337
Files:
lib/Transforms/IPO/PartialInlining.cpp
test/Transforms/CodeExtractor/PartialInlineVarArgsDebug.ll
Index: test/Transforms/CodeExtractor/PartialInlineVarArgsDebug.ll
===================================================================
--- test/Transforms/CodeExtractor/PartialInlineVarArgsDebug.ll
+++ test/Transforms/CodeExtractor/PartialInlineVarArgsDebug.ll
@@ -1,8 +1,8 @@
; RUN: opt < %s -S -partial-inliner -skip-partial-inlining-cost-analysis=true | FileCheck %s
-; CHECK-LABEL: @callee
+; CHECK: define i32 @callee(i32 %v, ...) [[FN_ATTRS:#[0-9]+]]
; CHECK: %mul = mul nsw i32 %v, 10, !dbg ![[DBG1:[0-9]+]]
-define i32 @callee(i32 %v, ...) !dbg !16 {
+define i32 @callee(i32 %v, ...) #0 !dbg !16 {
entry:
%cmp = icmp sgt i32 %v, 2000, !dbg !17
br i1 %cmp, label %if.then, label %if.end, !dbg !19
@@ -19,20 +19,23 @@
; CHECK-LABEL: @caller
; CHECK: codeRepl.i:
-; CHECK-NEXT: call void (i32, i32*, ...) @callee.1_if.then(i32 %v, i32* %mul.loc.i, i32 99), !dbg ![[DBG2:[0-9]+]]
+; CHECK-NEXT: call void (i32, i32*, ...) @callee.1_if.then(i32 %v, i32* %mul.loc.i, i32 99) [[FN_ATTRS]], !dbg ![[DBG2:[0-9]+]]
define i32 @caller(i32 %v) !dbg !8 {
entry:
- %call = call i32 (i32, ...) @callee(i32 %v, i32 99), !dbg !14
+ %call = call i32 (i32, ...) @callee(i32 %v, i32 99) #0, !dbg !14
ret i32 %call, !dbg !15
}
-; CHECK-LABEL: define internal void @callee.1_if.then
+; CHECK:define internal void @callee.1_if.then(i32 %v, i32* %mul.out, ...) [[FN_ATTRS]]
; CHECK: br label %if.then, !dbg ![[DBG3:[0-9]+]]
+; CHECK: attributes [[FN_ATTRS]] = { "foo"="bar" }
+
; CHECK: ![[DBG1]] = !DILocation(line: 10, column: 7,
; CHECK: ![[DBG2]] = !DILocation(line: 10, column: 7,
; CHECK: ![[DBG3]] = !DILocation(line: 10, column: 7,
+attributes #0 = { "foo"="bar" }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5, !6}
Index: lib/Transforms/IPO/PartialInlining.cpp
===================================================================
--- lib/Transforms/IPO/PartialInlining.cpp
+++ lib/Transforms/IPO/PartialInlining.cpp
@@ -1430,6 +1430,7 @@
CallInst *Call =
CallInst::Create(CI->getCalledFunction(), Params, "", CI);
Call->setDebugLoc(CI->getDebugLoc());
+ Call->setAttributes(CS.getAttributes());
CI->replaceAllUsesWith(Call);
CI->eraseFromParent();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41337.127294.patch
Type: text/x-patch
Size: 2264 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171218/09827a84/attachment.bin>
More information about the llvm-commits
mailing list