<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 11, 2015 at 1:50 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">We can simply document it. In other words, user is not expected  to use ":<num>" or ",<num>" as file suffix for profile data.  </div></blockquote><div><br></div><div>And if they would like to be bulletproof, then they should manually append `:1` or `:<num>`.</div><div><br></div><div>E.g. suppose they have a file called $STR. If they call `llvm-profdata merge $STR:1` then they are guaranteed that $STR will be interpreted properly no matter what characters it contains.</div><div><br></div><div>Another possibility is to have a syntax `llvm-profdata merge --file-with-weight=42,path/to/foo --file-with-weight=17,path/to/bar`. That way, we don't have any ambiguity in any scenario (except the existing potential ambiguity with names that start with `-`, but users already have to deal with this issue). That seems bulletproof, and we can document that plain `path/to/foo` is just syntax sugar for `--file-with-weight=1,path/to/foo`.</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>David</div></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 11, 2015 at 1:45 PM, Justin Bogner <span dir="ltr"><<a href="mailto:mail@justinbogner.com" target="_blank">mail@justinbogner.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>Xinliang David Li <<a href="mailto:davidxl@google.com" target="_blank">davidxl@google.com</a>> writes:<br>
> On Tue, Nov 10, 2015 at 2:36 PM, Diego Novillo <<a href="mailto:dnovillo@google.com" target="_blank">dnovillo@google.com</a>> wrote:<br>
>> On Tue, Nov 10, 2015 at 3:07 PM, David Li <<a href="mailto:davidxl@google.com" target="_blank">davidxl@google.com</a>> wrote:<br>
>>> ================<br>
>>> Comment at: test/tools/llvm-profdata/weight-sample.test:42<br>
>>> @@ +41,3 @@<br>
>>> +3- Bad merge: foo and bar profiles with too few weight values<br>
>>> +RUN: not llvm-profdata merge --sample --text -weights=2<br>
>>> %p/Inputs/weight-sample-bar.proftext %p/Inputs/weight-sample-foo.proftext<br>
>>> -o %t.out 2>&1 | FileCheck %s --check-prefix=ERROR1<br>
>>> +ERROR1: error: Profile weight must be specified for each input file.<br>
>>> ----------------<br>
>>> No need for such tests if the weight is always attached to the input file.<br>
>>><br>
>><br>
>> But then what happens if one of the files is specified without ":WEIGHT"?<br>
>> Should we complain about it?  Should we assume MAX(other weights)?<br>
><br>
> The default is 1 of course.<br>
><br>
>> I'm not sure I'm completely convinced that file1:W1 file2:W2 is better<br>
>> than --weights=W1,W2.  What if ':' is part of the filename?  I know, seems<br>
>> like a stretch.  I'm not actually arguing against it.  I mostly find it a<br>
>> bit odd.<br>
><br>
> : is just a suggestion, you can use coma to separate it.<br>
><br>
> pros:<br>
><br>
> 1) the weight and file name are always 'together'. Think about a long list<br>
> of files -- having a separate list option make it harder to associate and<br>
> and  can not really skip the default weight of 1, e.g<br>
> -W10,1,1,1,1,1,1,1,1,1,20<br>
> 2) there is no need for an additional option<br>
> 3) the implementation is simpler and requires fewer code.<br>
><br>
> cons:<br>
> I don't see any real cons -- except that you find it weird -- but why?<br>
<br>
</div></div>The biggest con is probably ambiguity. Using a comma isn't really any<br>
better than using a colon here, both are perfectly valid in filenames.<br>
I guess it's probably not likely that anyone has a file named foo and a<br>
file named foo:10 and wants to use foo with a weight of 10, but the code<br>
will certainly have to deal with that case if we're attaching the<br>
weights to the filenames.<br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">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>