[Patch][LoopVectorize] Print vectorization analysis when loop hint pragma is specified

Tyler Nowicki via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 18:57:23 PDT 2015


Hi Hal, Mark,

These patches solve the problem of having to explicitly enable analysis when specifying a loop hint pragma to get the diagnostics. Passing AlwasyPrint as the pass name (see below) causes the front-end to print the diagnostic if the user has specified '-Rpass-analysis' without an '=<target-pass>’. Users of loop hints can pass that compiler option without having to specify the pass and they will get diagnostics for only those loops with loop hints.

> const char *Name = Hints.isForced() ? DiagnosticInfo::AlwaysPrint : LV_NAME;

> emitAnalysis(Message, TheFunction, TheLoop, Name);


Mark: Would you be interested in extending this to the loop unroller as well?

> P.S. I assume we should add similar logic to the loop unroller (please add a FIXME if you're not going to do this yourself). Another place where this would be useful is to warn the user when a function marked always_inline is not actually inlined.


Hal: Thanks for the all the reviews Hal!

Committed in r244550, r244552,r244555, and r244556.

Tyler

> On Aug 9, 2015, at 9:59 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> 
> Hi Tyler,
> 
> Thanks for working on this!
> 
> +    // If a loop hint is provided the diagnostic is always produced.
> +    const char *name = Hints.isForced() ? DiagnosticInfo::AlwaysPrint : LV_NAME;
> 
> name -> Name
> 
> These LGTM.
> 
> P.S. I assume we should add similar logic to the loop unroller (please add a FIXME if you're not going to do this yourself). Another place where this would be useful is to warn the user when a function marked always_inline is not actually inlined.
> 
> -Hal
> 
> ----- Original Message -----
>> From: "Tyler Nowicki" <tnowicki at apple.com <mailto:tnowicki at apple.com>>
>> To: "Gonzalo BG" <gonzalobg88 at gmail.com <mailto:gonzalobg88 at gmail.com>>, "Hal J. Finkel" <hfinkel at anl.gov <mailto:hfinkel at anl.gov>>, "Commit Messages and Patches for LLVM"
>> <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>>, "llvm cfe" <cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>>
>> Cc: "Gerolf Hoflehner" <ghoflehner at apple.com <mailto:ghoflehner at apple.com>>
>> Sent: Friday, August 7, 2015 4:15:51 PM
>> Subject: [Patch][LoopVectorize] Print vectorization analysis when loop hint pragma is specified
>> 
>> 
>> Hi,
>> 
>> 
>> 
>> 
>> 
>> Currently, when loop hint is used but vectorization fails we generate
>> a warning. To get the analysis the user needs to provide the command
>> line option -Rpass-analysis=<passname> with the correct pass name.
>> BUT we don’t tell the user which pass name they will need to get the
>> analysis message. We should be displaying the analysis without
>> having to request it.
>> 
>> 
>> These patches print the analysis information when vectorization fails
>> on loops with hints when the compiler option ‘-Rpass-analysis’ is
>> provided without ‘=<passname>'. Users of loop hints can provide the
>> compiler option with their regular debug builds to ensure they
>> always get the analysis when vectorization fails. This approach is
>> preferred because diagnostic printing needs line number tracking
>> which is not enabled by normally. Specifying the option without a
>> pass-target enables line number tracking and makes viewing the
>> messages optional.
>> 
>> 
>> The LLVM patches modify the pass-name of the diagnostic to
>> DiagnosticInfo::AlwaysPrint, which is an empty const char*. The use
>> of DiagnosticInfo::AlwaysPrint is recognized when filtering the
>> diagnostics allowing the message to be printed even if the filter
>> doesn’t match. Note that the analysis of loops with hints will
>> always be printed whenever the compiler option is provided even if
>> ‘=<pass name>' is specified. This allows both types of analyses to
>> be printed at the same time rather than hiding the analysis on loops
>> with hints with an pass-target is given.
>> 
>> 
>> *These patches build on several previous patches still in review to
>> add late-diagnostics for fp-commut and aliasing. See threads ' Late
>> evaluation of vectorization r equirements’ and ' Late evaluate of
>> runtime pointer check's threshold' .
>> 
>> 
>> Comments and reviews are much appreciated!
>> 
>> 
>> Tyler
>> 
>> 
>> (sorry if you received this twice. I used the wrong mailing list
>> addresses)
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 
> -- 
> Hal Finkel
> Assistant Computational Scientist
> Leadership Computing Facility
> Argonne National Laboratory

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150810/5ffa8cec/attachment.html>


More information about the cfe-commits mailing list