[llvm-commits] [PATCH/RFC] Loop Data Software Prefetching

Andrew Trick atrick at apple.com
Tue Feb 5 10:10:33 PST 2013


On Feb 2, 2013, at 9:13 PM, Hal Finkel <hfinkel at anl.gov> wrote:

> ----- Original Message -----
>> From: "Andrew Trick" <atrick at apple.com>
>> To: "Hal Finkel" <hfinkel at anl.gov>
>> Cc: "Evan Cheng" <evan.cheng at apple.com>, "l >> Commit Messages and Patches for LLVM" <llvm-commits at cs.uiuc.edu>
>> Sent: Friday, February 1, 2013 12:45:51 AM
>> Subject: Re: [llvm-commits] [PATCH/RFC] Loop Data Software Prefetching
>> 
>> 
>> 
>> 
>> On Jan 29, 2013, at 12:39 PM, Hal Finkel < hfinkel at anl.gov > wrote:
>> 
>> 
>> 2. Applying this patch causes three regression test failures:
>> LLVM :: CodeGen/X86/lsr-negative-stride.ll
>> LLVM :: Transforms/LoopStrengthReduce/X86/2011-12-04-loserreg.ll
>> LLVM :: Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll
>> 
>> these failures are triggered just by the fact that the pass is
>> scheduled prior to LSR running, even though it does not change
>> anything. Does anyone know how this might happen?
>> 
>> I'm not sure, but I'm curious. Can you print the IR input to LSR in
>> each case and also debug-pass=Executions? Prefetching must have
>> either invalidated an analysis or changed the loop pass manager.
> 
> Here's the funny part: If I comment out:
> AU.addPreserved<ScalarEvolution>();
> in the LoopDataPrefetch pass, then all of the regression tests pass as expected.
> 
> And, to be clear, the bug is triggered by the LoopDataPrefetch pass doing nothing, meaning:
> bool LoopDataPrefetch::runOnLoop(Loop *L, LPPassManager &LPM) {
>  return false;
> }
> 
> So, for some reason, preserving ScalarEvolution is problematic.

Hal,

Adding LoopDataPrefetch to the PassManager effectively breaks LSR in nested loops. LoopSimplify cannot run in the same loop pass manager as LSR because the entire nest must be simplified first. This is one of the nasty
requirements of SCEVExpander.

The attached pass fixes it. Basically, once you start adding "lowering" passes, normal pass manager rules no longer apply. Instead we have to rig the system the schedule passes in the right order.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: run-loop-simp.patch
Type: application/octet-stream
Size: 1128 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130205/f0bfef01/attachment.obj>
-------------- next part --------------


FYI: I did modify these tests to use opt, but have lost my changes. At any rate, it actually makes sense to leave them as llc tests until we have a way for opt/llc to share a PassManagerBuilder.

-Andy


More information about the llvm-commits mailing list