Use auto profiler to set branch weights

Diego Novillo dnovillo at google.com
Wed Oct 30 07:03:14 PDT 2013


On Tue, Oct 29, 2013 at 6:11 PM, Eric Christopher <echristo at gmail.com> wrote:

> *nod* Have you tried turning on column information via the front end?

Yes, but that information does not survive through Perf. At least, not
that I can tell. I have not really looked into it.

>> What string?  The filename?  How else would I pass it to the backend?
>> I don't understand what you mean with 'having a command line variable
>> that contains the string'.
>>
>
> Chandler would probably kill me but I meant something like:
>
>   cl::opt<string> InputFilename...
>
> that's then passed by the front end. I'd rather it be part of the pass
> constructor myself where you've got it.

Sorry. You have now completely lost me. I believe I already have this.
Near the top of the file:

// command line option for loading path profiles
static cl::opt<std::string> AutoProfileFilename(
    "auto-profile-file", cl::init("autoprof.llvm"), cl::value_desc("filename"),
    cl::desc("Profile file loaded by -auto-profile"), cl::Hidden);

This is only used by 'opt'. The front end instantiates the pass by
setting AutoProfileFilename in the -fauto-profile=... handler
(http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131021/091439.html).

> dumpInstrumentedInsns: I'd probably make this printInstrumentedInsns with a
> dump that defaults to dbgs() etc.

Done.

>
> Missed a few names ;)
>
> +      unsigned line_offset = atoi(Matches[1].str().c_str());
> +  StringRef name = F.getName();
> +      SmallVector<Value *, 1> sample_values;
> +  LLVMContext &context = FirstInst.getContext();

Done.


> Using the regex support to read the file is exciting. Curious why? :)

Parsing. The format of the text file is very amenable to regexps.

Since Chandler wanted to use phabricator for this, I've updated the
phabricator patch: http://llvm-reviews.chandlerc.com/D2058


Diego.



More information about the llvm-commits mailing list