<div dir="ltr">You're right: it looks like the bot ran between the two commits and therefore didn't see the clang one. It's fixed now. Thanks!</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 12, 2015 at 10:06 PM, Xinliang David Li <span dir="ltr"><<a href="mailto:xinliangli@gmail.com" target="_blank">xinliangli@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The tests were updated right after the LLVM change. Let me know if you still had the problem.<div><br></div><div>thanks,</div><div><br></div><div>David</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 12, 2015 at 12:14 PM, JF Bastien via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi David,<div><br></div><div>It looks like this patch causes the following failures:</div><div>    Clang :: CoverageMapping/unused_names.c</div><div>    Clang :: Profile/c-captured.c</div><div>    Clang :: Profile/c-general.c</div><div>    Clang :: Profile/c-linkage.c</div><div>    Clang :: Profile/cxx-lambda.cpp</div><div>    Clang :: Profile/objc-general.m</div><div><br></div><div>Log: <a href="https://build.chromium.org/p/client.wasm.llvm/builders/linux/builds/856/steps/steps/logs/stdio" target="_blank">https://build.chromium.org/p/client.wasm.llvm/builders/linux/builds/856/steps/steps/logs/stdio</a></div><div><br></div><div>Could you look into it or revert?</div><div><br></div><div>Thanks,</div><div><br></div><div>JF</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 12, 2015 at 6:28 PM, Xinliang David Li via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: davidxl<br>
Date: Sat Dec 12 11:28:03 2015<br>
New Revision: 255434<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=255434&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=255434&view=rev</a><br>
Log:<br>
[PGO] Stop using invalid char in instr variable names.<br>
<br>
Before the patch, -fprofile-instr-generate compile will fail<br>
if no integrated-as is specified when the file contains<br>
any static functions (the -S output is also invalid).<br>
<br>
This is the second try. The fix in this patch is very localized.<br>
Only profile symbol names of profile symbols with internal<br>
linkage are fixed up while initializer of name syms are not<br>
changes. This means there is no format change nor version bump.<br>
<br>
<br>
<br>
Modified:<br>
    llvm/trunk/lib/ProfileData/InstrProf.cpp<br>
    llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp<br>
    llvm/trunk/test/Instrumentation/InstrProfiling/profiling.ll<br>
    llvm/trunk/test/Transforms/PGOProfile/criticaledge.ll<br>
<br>
Modified: llvm/trunk/lib/ProfileData/InstrProf.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProf.cpp?rev=255434&r1=255433&r2=255434&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProf.cpp?rev=255434&r1=255433&r2=255434&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/ProfileData/InstrProf.cpp (original)<br>
+++ llvm/trunk/lib/ProfileData/InstrProf.cpp Sat Dec 12 11:28:03 2015<br>
@@ -102,6 +102,26 @@ std::string getPGOFuncName(const Functio<br>
                         Version);<br>
 }<br>
<br>
+// \p FuncName is the string used as profile lookup key for the function. A<br>
+// symbol is created to hold the name. Return the legalized symbol name.<br>
+static std::string getPGOFuncNameVarName(StringRef FuncName,<br>
+                                         GlobalValue::LinkageTypes Linkage) {<br>
+  std::string VarName = getInstrProfNameVarPrefix();<br>
+  VarName += FuncName;<br>
+<br>
+  if (!GlobalValue::isLocalLinkage(Linkage))<br>
+    return VarName;<br>
+<br>
+  // Now fix up illegal chars in local VarName that may upset the assembler.<br>
+  const char *InvalidChars = "-:<>\"'";<br>
+  size_t found = VarName.find_first_of(InvalidChars);<br>
+  while (found != std::string::npos) {<br>
+    VarName[found] = '_';<br>
+    found = VarName.find_first_of(InvalidChars, found + 1);<br>
+  }<br>
+  return VarName;<br>
+}<br>
+<br>
 GlobalVariable *createPGOFuncNameVar(Module &M,<br>
                                      GlobalValue::LinkageTypes Linkage,<br>
                                      StringRef FuncName) {<br>
@@ -120,7 +140,7 @@ GlobalVariable *createPGOFuncNameVar(Mod<br>
   auto *Value = ConstantDataArray::getString(M.getContext(), FuncName, false);<br>
   auto FuncNameVar =<br>
       new GlobalVariable(M, Value->getType(), true, Linkage, Value,<br>
-                         Twine(getInstrProfNameVarPrefix()) + FuncName);<br>
+                         getPGOFuncNameVarName(FuncName, Linkage));<br>
<br>
   // Hide the symbol so that we correctly get a copy for each executable.<br>
   if (!GlobalValue::isLocalLinkage(FuncNameVar->getLinkage()))<br>
<br>
Modified: llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp?rev=255434&r1=255433&r2=255434&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp?rev=255434&r1=255433&r2=255434&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp Sat Dec 12 11:28:03 2015<br>
@@ -265,8 +265,8 @@ void InstrProfiling::lowerCoverageData(G<br>
<br>
 /// Get the name of a profiling variable for a particular function.<br>
 static std::string getVarName(InstrProfIncrementInst *Inc, StringRef Prefix) {<br>
-  auto *Arr = cast<ConstantDataArray>(Inc->getName()->getInitializer());<br>
-  StringRef Name = Arr->isCString() ? Arr->getAsCString() : Arr->getAsString();<br>
+  StringRef NamePrefix = getInstrProfNameVarPrefix();<br>
+  StringRef Name = Inc->getName()->getName().substr(NamePrefix.size());<br>
   return (Prefix + Name).str();<br>
 }<br>
<br>
<br>
Modified: llvm/trunk/test/Instrumentation/InstrProfiling/profiling.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/InstrProfiling/profiling.ll?rev=255434&r1=255433&r2=255434&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/InstrProfiling/profiling.ll?rev=255434&r1=255433&r2=255434&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Instrumentation/InstrProfiling/profiling.ll (original)<br>
+++ llvm/trunk/test/Instrumentation/InstrProfiling/profiling.ll Sat Dec 12 11:28:03 2015<br>
@@ -6,8 +6,8 @@ target triple = "x86_64-apple-macosx10.1<br>
 ; CHECK: @__llvm_profile_name_foo = hidden constant [3 x i8] c"foo", section "__DATA,__llvm_prf_names", align 1<br>
 @__llvm_profile_name_bar = hidden constant [4 x i8] c"bar\00"<br>
 ; CHECK: @__llvm_profile_name_bar = hidden constant [4 x i8] c"bar\00", section "__DATA,__llvm_prf_names", align 1<br>
-@baz_prof_name = hidden constant [3 x i8] c"baz"<br>
-; CHECK: @baz_prof_name = hidden constant [3 x i8] c"baz", section "__DATA,__llvm_prf_names", align 1<br>
+@__llvm_profile_name_baz = hidden constant [3 x i8] c"baz"<br>
+; CHECK: @__llvm_profile_name_baz = hidden constant [3 x i8] c"baz", section "__DATA,__llvm_prf_names", align 1<br>
<br>
 ; CHECK: @__llvm_profile_counters_foo = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8<br>
 ; CHECK: @__llvm_profile_data_foo = hidden {{.*}}, section "__DATA,__llvm_prf_data", align 8<br>
@@ -26,9 +26,9 @@ define void @bar() {<br>
 ; CHECK: @__llvm_profile_counters_baz = hidden global [3 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8<br>
 ; CHECK: @__llvm_profile_data_baz = hidden {{.*}}, section "__DATA,__llvm_prf_data", align 8<br>
 define void @baz() {<br>
-  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @baz_prof_name, i32 0, i32 0), i64 0, i32 3, i32 0)<br>
-  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @baz_prof_name, i32 0, i32 0), i64 0, i32 3, i32 1)<br>
-  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @baz_prof_name, i32 0, i32 0), i64 0, i32 3, i32 2)<br>
+  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__llvm_profile_name_baz, i32 0, i32 0), i64 0, i32 3, i32 0)<br>
+  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__llvm_profile_name_baz, i32 0, i32 0), i64 0, i32 3, i32 1)<br>
+  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__llvm_profile_name_baz, i32 0, i32 0), i64 0, i32 3, i32 2)<br>
   ret void<br>
 }<br>
<br>
<br>
Modified: llvm/trunk/test/Transforms/PGOProfile/criticaledge.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/PGOProfile/criticaledge.ll?rev=255434&r1=255433&r2=255434&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/PGOProfile/criticaledge.ll?rev=255434&r1=255433&r2=255434&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/PGOProfile/criticaledge.ll (original)<br>
+++ llvm/trunk/test/Transforms/PGOProfile/criticaledge.ll Sat Dec 12 11:28:03 2015<br>
@@ -5,7 +5,7 @@ target datalayout = "e-m:e-i64:64-f80:12<br>
 target triple = "x86_64-unknown-linux-gnu"<br>
<br>
 ; GEN: @__llvm_profile_name_test_criticalEdge = private constant [17 x i8] c"test_criticalEdge"<br>
-; GEN: @"__llvm_profile_name_<stdin>:bar" = private constant [11 x i8] c"<stdin>:bar"<br>
+; GEN: @__llvm_profile_name__stdin__bar = private constant [11 x i8] c"<stdin>:bar"<br>
<br>
 define i32 @test_criticalEdge(i32 %i, i32 %j) {<br>
 entry:<br>
@@ -99,7 +99,7 @@ return:<br>
<br>
 define internal i32 @bar(i32 %i) {<br>
 entry:<br>
-; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @"__llvm_profile_name_<stdin>:bar", i32 0, i32 0), i64 12884901887, i32 1, i32 0)<br>
+; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__llvm_profile_name__stdin__bar, i32 0, i32 0), i64 12884901887, i32 1, i32 0)<br>
   ret i32 %i<br>
 }<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>