<div dir="ltr">Thanks for the quick fix. The test works on x86_64-unknown-linux-gnu now.<div><br></div><div>--Artem</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 29, 2016 at 3:24 PM, Betul Buyukkurt <span dir="ltr"><<a href="mailto:betulb@codeaurora.org" target="_blank">betulb@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Hi Artem, <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I’ve uploaded a patch to remove the alignment. <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Thanks,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">-Betul<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Artem Belevich [mailto:<a href="mailto:tra@google.com" target="_blank">tra@google.com</a>] <br><b>Sent:</b> Tuesday, March 29, 2016 3:15 PM<br><b>To:</b> Betul Buyukkurt <<a href="mailto:betulb@codeaurora.org" target="_blank">betulb@codeaurora.org</a>><br><b>Cc:</b> cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>><br><b>Subject:</b> Re: r264783 - [PGO] Move the instrumentation point closer to the value site.<u></u><u></u></span></p><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">Hi,<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">FYI, <span style="font-size:9.5pt;background:white">cxx</span><span style="font-size:9.5pt">-<span style="background:white">indirect</span>-<span style="background:white">call</span>.<span style="background:white">cpp</span> </span>test fails on platforms with different alignment. It may help to either use specific target or change your patterns to accommodate other targets.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">--Artem<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">******************** TEST 'Clang :: Profile/cxx-indirect-call.cpp' FAILED ********************<u></u><u></u></p></div><div><div><p class="MsoNormal">Script:<u></u><u></u></p></div><div><p class="MsoNormal">--<u></u><u></u></p></div><div><p class="MsoNormal">/usr/local/google/home/tra/work/llvm/build/gpu/release/./bin/clang --driver-mode=g++ /work/tra/llvm/tools/clang/test/Profile/cxx-indirect-call.cpp -o - -emit-llvm -S -fprofile-instr-generate -mllvm -enable-value-profiling -fexceptions -target x86_64-unknown-linux-gnu | /usr/local/google/home/tra/work/llvm/build/gpu/release/./bin/FileCheck /work/tra/llvm/tools/clang/test/Profile/cxx-indirect-call.cpp<u></u><u></u></p></div><div><p class="MsoNormal">--<u></u><u></u></p></div><div><p class="MsoNormal">Exit Code: 1<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Command Output (stderr):<u></u><u></u></p></div><div><p class="MsoNormal">--<u></u><u></u></p></div><div><p class="MsoNormal">/work/tra/llvm/tools/clang/test/Profile/cxx-indirect-call.cpp:8:11: error: expected string not found in input<u></u><u></u></p></div><div><p class="MsoNormal">// CHECK: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 4<u></u><u></u></p></div><div><p class="MsoNormal"> ^<u></u><u></u></p></div><div><p class="MsoNormal"><stdin>:1:1: note: scanning from here<u></u><u></u></p></div><div><p class="MsoNormal">; ModuleID = '/work/tra/llvm/tools/clang/test/Profile/cxx-indirect-call.cpp'<u></u><u></u></p></div><div><p class="MsoNormal">^<u></u><u></u></p></div><div><p class="MsoNormal"><stdin>:27:2: note: possible intended match here<u></u><u></u></p></div><div><p class="MsoNormal"> %11 = load void ()*, void ()** @foo, align 8<u></u><u></u></p></div><div><p class="MsoNormal"> ^<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">--<u></u><u></u></p></div></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Tue, Mar 29, 2016 at 1:44 PM, Betul Buyukkurt via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<u></u><u></u></p><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in"><p class="MsoNormal">Author: betulb<br>Date: Tue Mar 29 15:44:09 2016<br>New Revision: 264783<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=264783&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=264783&view=rev</a><br>Log:<br>[PGO] Move the instrumentation point closer to the value site.<br><br>For terminator instructions, the value profiling instrumentation<br>happens in a basic block other than where the value site resides.<br>This CR moves the instrumentation point prior to the value site.<br>Mostly NFC.<br><br><br>Added:<br> cfe/trunk/test/Profile/cxx-indirect-call.cpp<br>Modified:<br> cfe/trunk/lib/CodeGen/CodeGenPGO.cpp<br> cfe/trunk/test/Profile/c-indirect-call.c<br><br>Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=264783&r1=264782&r2=264783&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=264783&r1=264782&r2=264783&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)<br>+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Tue Mar 29 15:44:09 2016<br>@@ -757,10 +757,10 @@ void CodeGenPGO::valueProfile(CGBuilderT<br><br> bool InstrumentValueSites = CGM.getCodeGenOpts().hasProfileClangInstr();<br> if (InstrumentValueSites && RegionCounterMap) {<br>- llvm::LLVMContext &Ctx = CGM.getLLVMContext();<br>- auto *I8PtrTy = llvm::Type::getInt8PtrTy(Ctx);<br>+ auto BuilderInsertPoint = Builder.saveIP();<br>+ Builder.SetInsertPoint(ValueSite);<br> llvm::Value *Args[5] = {<br>- llvm::ConstantExpr::getBitCast(FuncNameVar, I8PtrTy),<br>+ llvm::ConstantExpr::getBitCast(FuncNameVar, Builder.getInt8PtrTy()),<br> Builder.getInt64(FunctionHash),<br> Builder.CreatePtrToInt(ValuePtr, Builder.getInt64Ty()),<br> Builder.getInt32(ValueKind),<br>@@ -768,6 +768,7 @@ void CodeGenPGO::valueProfile(CGBuilderT<br> };<br> Builder.CreateCall(<br> CGM.getIntrinsic(llvm::Intrinsic::instrprof_value_profile), Args);<br>+ Builder.restoreIP(BuilderInsertPoint);<br> return;<br> }<br><br><br>Modified: cfe/trunk/test/Profile/c-indirect-call.c<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/c-indirect-call.c?rev=264783&r1=264782&r2=264783&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/c-indirect-call.c?rev=264783&r1=264782&r2=264783&view=diff</a><br>==============================================================================<br>--- cfe/trunk/test/Profile/c-indirect-call.c (original)<br>+++ cfe/trunk/test/Profile/c-indirect-call.c Tue Mar 29 15:44:09 2016<br>@@ -1,13 +1,14 @@<br>-// Check the data structures emitted by instrumentation.<br>+// Check the value profiling instrinsics emitted by instrumentation.<br>+<br> // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck %s<br><br> void (*foo)(void);<br><br> int main(void) {<br> // CHECK: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8<br>-// CHECK-NEXT: call void [[REG1]]()<br> // CHECK-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64<br> // CHECK-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({{.*}}* @__profd_main to i8*), i32 0)<br>+// CHECK-NEXT: call void [[REG1]]()<br> foo();<br> return 0;<br> }<br><br>Added: cfe/trunk/test/Profile/cxx-indirect-call.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/cxx-indirect-call.cpp?rev=264783&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/cxx-indirect-call.cpp?rev=264783&view=auto</a><br>==============================================================================<br>--- cfe/trunk/test/Profile/cxx-indirect-call.cpp (added)<br>+++ cfe/trunk/test/Profile/cxx-indirect-call.cpp Tue Mar 29 15:44:09 2016<br>@@ -0,0 +1,21 @@<br>+// Check the value profiling instrinsics emitted by instrumentation.<br>+<br>+// RUN: %clangxx %s -o - -emit-llvm -S -fprofile-instr-generate -mllvm -enable-value-profiling -fexceptions -target %itanium_abi_triple | FileCheck %s<br>+<br>+void (*foo) (void);<br>+<br>+int main(int argc, const char *argv[]) {<br>+// CHECK: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 4<br>+// CHECK-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64<br>+// CHECK-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({{.*}}* @__profd_main to i8*), i32 0)<br>+// CHECK-NEXT: invoke void [[REG1]]()<br>+ try {<br>+ foo();<br>+ } catch (int) {}<br>+ return 0;<br>+}<br>+<br>+// CHECK: declare void @__llvm_profile_instrument_target(i64, i8*, i32)<br>+<br>+<br>+<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><u></u><u></u></p></blockquote></div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><div><p class="MsoNormal">--Artem Belevich<u></u><u></u></p></div></div></div></div></div></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">--Artem Belevich</div></div>
</div>