[llvm] r267815 - [PGO] Promote indirect calls to conditional direct calls with value-profile

Ismail Donmez via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 10:38:13 PDT 2016


Yes that fixes it! Please commit, thanks!

On Thu, Apr 28, 2016 at 7:53 PM, Rong Xu <xur at google.com> wrote:
> It seems the use of Twine to output remar message is not valid. I should not
> store a temporal Twine.
>
> Ismall: could you help to check if the attached patch solve the issue?
> Thanks a lot!
>
> -Rong
>
> On Thu, Apr 28, 2016 at 9:21 AM, Ismail Donmez <ismail at i10z.com> wrote:
>>
>> Here:
>>
>> win7-vbox ~ > "C:/cygwin64/home/ismail/src/llvm/dist/./bin\opt.EXE" <
>>
>> "C:\cygwin64\home\ismail\src\llvm\test\Transforms\PGOProfile\icp_mismatch_msg.ll"
>> -pgo-icall-prom -pass-remarks-missed=PGOIndirectCallPromotion -S 2>& 1
>> remark: <unknown>:0:0: : The number of arguments mismatch
>> remark: <unknown>:0:0: : Cannot find the target
>> remark: <unknown>:0:0: : Return type mismatch
>> ; ModuleID = '<stdin>'
>> source_filename = "<stdin>"
>> target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
>> target triple = "x86_64-unknown-linux-gnu"
>>
>> @foo = common global i32 ()* null, align 8
>> @foo2 = common global i32 ()* null, align 8
>> @foo3 = common global i32 ()* null, align 8
>>
>> define i32 @func4(i32 %i) {
>> entry:
>>   ret i32 %i
>> }
>>
>> define void @func2() {
>> entry:
>>   ret void
>> }
>>
>> define i32 @bar() {
>> entry:
>>   %tmp = load i32 ()*, i32 ()** @foo, align 8
>>   %call = call i32 %tmp(), !prof !0
>>   %tmp2 = load i32 ()*, i32 ()** @foo2, align 8
>>   %call1 = call i32 %tmp2(), !prof !1
>>   %add = add nsw i32 %call1, %call
>>   %tmp3 = load i32 ()*, i32 ()** @foo3, align 8
>>   %call2 = call i32 %tmp3(), !prof !2
>>   %add2 = add nsw i32 %add, %call2
>>   ret i32 %add2
>> }
>>
>> !0 = !{!"VP", i32 0, i64 1801, i64 7651369219802541373, i64 1234, i64
>> -4377547752858689819, i64 567}
>> !1 = !{!"VP", i32 0, i64 3023, i64 -6929281286627296573, i64 2345, i64
>> -4377547752858689819, i64 678}
>> !2 = !{!"VP", i32 0, i64 7890, i64 -4377547752858689819, i64 7890}
>>
>> win7-vbox ~ > "C:/cygwin64/home/ismail/src/llvm/dist/./bin\opt.EXE" <
>> "C:\cygwin64\home\ismail\src\llvm\test\Transforms\PGOPro
>> file\indirect_call_promotion.ll" -pgo-icall-prom -S
>> -pass-remarks=PGOIndirectCallPromotion -icp-count-threshold=0
>> -icp-percent
>> -threshold=0 -icp-max-prom=4 2>&1
>> remark: <unknown>:0:0: 1600
>> remark: <unknown>:0:0: 570
>> remark: <unknown>:0:0: 160
>> remark: <unknown>:0:0: 10
>> ; ModuleID = '<stdin>'
>> source_filename = "<stdin>"
>> target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
>> target triple = "x86_64-unknown-linux-gnu"
>>
>> @foo = common global i32 ()* null, align 8
>>
>> define i32 @func1() {
>> entry:
>>   ret i32 0
>> }
>>
>> define i32 @func2() {
>> entry:
>>   ret i32 1
>> }
>>
>> define i32 @func3() {
>> entry:
>>   ret i32 2
>> }
>>
>> define i32 @func4() {
>> entry:
>>   ret i32 3
>> }
>>
>> define i32 @bar() {
>> entry:
>>   %tmp = load i32 ()*, i32 ()** @foo, align 8
>>   %0 = bitcast i32 ()* %tmp to i8*
>>   %1 = icmp eq i8* %0, bitcast (i32 ()* @func4 to i8*)
>>   br i1 %1, label %if.true.direct_targ, label %if.false.orig_indirect,
>> !prof !0
>>
>> if.true.direct_targ:                              ; preds = %entry
>>   %2 = call i32 @func4()
>>   br label %if.end.icp
>>
>> if.false.orig_indirect:                           ; preds = %entry
>>   %3 = bitcast i32 ()* %tmp to i8*
>>   %4 = icmp eq i8* %3, bitcast (i32 ()* @func2 to i8*)
>>   br i1 %4, label %if.true.direct_targ1, label
>> %if.false.orig_indirect2, !prof !1
>>
>> if.true.direct_targ1:                             ; preds =
>> %if.false.orig_indirect
>>   %5 = call i32 @func2()
>>   br label %if.end.icp3
>>
>> if.false.orig_indirect2:                          ; preds =
>> %if.false.orig_indirect
>>   %6 = bitcast i32 ()* %tmp to i8*
>>   %7 = icmp eq i8* %6, bitcast (i32 ()* @func3 to i8*)
>>   br i1 %7, label %if.true.direct_targ4, label
>> %if.false.orig_indirect5, !prof !2
>>
>> if.true.direct_targ4:                             ; preds =
>> %if.false.orig_indirect2
>>   %8 = call i32 @func3()
>>   br label %if.end.icp6
>>
>> if.false.orig_indirect5:                          ; preds =
>> %if.false.orig_indirect2
>>   %9 = bitcast i32 ()* %tmp to i8*
>>   %10 = icmp eq i8* %9, bitcast (i32 ()* @func1 to i8*)
>>   br i1 %10, label %if.true.direct_targ7, label
>> %if.false.orig_indirect8, !prof !3
>>
>> if.true.direct_targ7:                             ; preds =
>> %if.false.orig_indirect5
>>   %11 = call i32 @func1()
>>   br label %if.end.icp9
>>
>> if.false.orig_indirect8:                          ; preds =
>> %if.false.orig_indirect5
>>   %call = call i32 %tmp()
>>   br label %if.end.icp9
>>
>> if.end.icp9:                                      ; preds =
>> %if.false.orig_indirect8, %if.true.direct_targ7
>>   %12 = phi i32 [ %call, %if.false.orig_indirect8 ], [ %11,
>> %if.true.direct_targ7 ]
>>   br label %if.end.icp6
>>
>> if.end.icp6:                                      ; preds =
>> %if.end.icp9, %if.true.direct_targ4
>>   %13 = phi i32 [ %12, %if.end.icp9 ], [ %8, %if.true.direct_targ4 ]
>>   br label %if.end.icp3
>>
>> if.end.icp3:                                      ; preds =
>> %if.end.icp6, %if.true.direct_targ1
>>   %14 = phi i32 [ %13, %if.end.icp6 ], [ %5, %if.true.direct_targ1 ]
>> br label %if.end.icp
>>
>> if.end.icp:                                       ; preds =
>> %if.end.icp3, %if.true.direct_targ
>>   %15 = phi i32 [ %14, %if.end.icp3 ], [ %2, %if.true.direct_targ ]
>>   ret i32 %15
>> }
>>
>> !0 = !{!"branch_weights", i32 1030, i32 570}
>> !1 = !{!"branch_weights", i32 410, i32 160}
>> !2 = !{!"branch_weights", i32 150, i32 10}
>> !3 = !{!"branch_weights", i32 10, i32 0}
>>
>> On Thu, Apr 28, 2016 at 6:53 PM, Xinliang David Li <xinliangli at gmail.com>
>> wrote:
>> > what I meant is the output that gets piped to FileCheck, not the
>> > FileCheck
>> > output.
>> >
>> > thanks,
>> >
>> > David
>> >
>> > On Thu, Apr 28, 2016 at 8:48 AM, Ismail Donmez <ismail at i10z.com> wrote:
>> >>
>> >> That's all of the output (excluding the command line part).
>> >>
>> >> On Thu, Apr 28, 2016 at 6:46 PM, Xinliang David Li
>> >> <xinliangli at gmail.com>
>> >> wrote:
>> >> > What does the actual output look like?
>> >> >
>> >> > David
>> >> >
>> >> > On Thu, Apr 28, 2016 at 1:57 AM, Ismail Donmez via llvm-commits
>> >> > <llvm-commits at lists.llvm.org> wrote:
>> >> >>
>> >> >> Hi,
>> >> >>
>> >> >> On Thu, Apr 28, 2016 at 2:20 AM, Rong Xu via llvm-commits
>> >> >> <llvm-commits at lists.llvm.org> wrote:
>> >> >> > Author: xur
>> >> >> > Date: Wed Apr 27 18:20:27 2016
>> >> >> > New Revision: 267815
>> >> >> >
>> >> >> > URL: http://llvm.org/viewvc/llvm-project?rev=267815&view=rev
>> >> >> > Log:
>> >> >> > [PGO] Promote indirect calls to conditional direct calls with
>> >> >> > value-profile
>> >> >> >
>> >> >> > This patch implements the transformation that promotes indirect
>> >> >> > calls
>> >> >> > to
>> >> >> > conditional direct calls when the indirect-call value profile
>> >> >> > meta-data
>> >> >> > is
>> >> >> > available.
>> >> >> >
>> >> >> > Differential Revision: http://reviews.llvm.org/D17864
>> >> >> >
>> >> >> > Added:
>> >> >> >
>> >> >> >
>> >> >> > llvm/trunk/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
>> >> >> >
>> >> >> > llvm/trunk/test/Transforms/PGOProfile/icp_covariant_call_return.ll
>> >> >> >
>> >> >> >
>> >> >> > llvm/trunk/test/Transforms/PGOProfile/icp_covariant_invoke_return.ll
>> >> >> >     llvm/trunk/test/Transforms/PGOProfile/icp_invoke.ll
>> >> >> >     llvm/trunk/test/Transforms/PGOProfile/icp_mismatch_msg.ll
>> >> >> >     llvm/trunk/test/Transforms/PGOProfile/icp_vararg.ll
>> >> >> >
>> >> >> > llvm/trunk/test/Transforms/PGOProfile/indirect_call_promotion.ll
>> >> >> > Modified:
>> >> >> >     llvm/trunk/include/llvm/InitializePasses.h
>> >> >> >     llvm/trunk/include/llvm/LinkAllPasses.h
>> >> >> >     llvm/trunk/include/llvm/Transforms/Instrumentation.h
>> >> >> >     llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
>> >> >> >     llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt
>> >> >> >     llvm/trunk/lib/Transforms/Instrumentation/Instrumentation.cpp
>> >> >>
>> >> >> Fails with VS2015 x64:
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> C:\cygwin64\home\ismail\src\llvm\test\Transforms\PGOProfile\icp_mismatch_msg.ll:3:10:
>> >> >> error: expected string not found in input
>> >> >> ; CHECK: remark: <unknown>:0:0: Cannot promote indirect call to
>> >> >> func4
>> >> >> with count of 1234: The number of arguments mismatch
>> >> >>          ^
>> >> >> <stdin>:1:1: note: scanning from here
>> >> >> remark: <unknown>:0:0: : The number of arguments mismatch
>> >> >> ^
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> C:\cygwin64\home\ismail\src\llvm\test\Transforms\PGOProfile\indirect_call_promotion.ll:3:16:
>> >> >> error: expected string not found in input
>> >> >> ; PASS-REMARK: remark: <unknown>:0:0: Promote indirect call to func4
>> >> >> with count 1030 out of 1600
>> >> >>                ^
>> >> >> <stdin>:1:1: note: scanning from here
>> >> >> remark: <unknown>:0:0: 1600
>> >> >> ^
>> >> >> _______________________________________________
>> >> >> llvm-commits mailing list
>> >> >> llvm-commits at lists.llvm.org
>> >> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>> >> >
>> >> >
>> >
>> >
>
>


More information about the llvm-commits mailing list