[LLVMdev] Load PRE in loops with 'mostly' invariant loads

Philip Reames listmail at philipreames.com
Mon Jan 19 16:45:52 PST 2015


(Splitting this out from "Re: [LLVMdev] Separating loop nests based on 
profile information?" since it's now a fairly different topic.)

On 01/09/2015 11:39 AM, Philip Reames wrote:
> On 01/08/2015 12:33 PM, Philip Reames wrote:
>> 2) We need PRE to look back through merge blocks.  This should 
>> possibly even live in MemoryDependenceAnalysis.  Alternatively, we 
>> could create a "deconstruct loop simplify form" pass to run right 
>> before GVN to side step this issue.
> Point 2 here may be inaccurate.  I've definitely seen problems here in 
> the past, but when I sat down to write some test cases, it looks like 
> the simple merge block for latch (with the load being considered in 
> the loop header) works just fine.  I suspect my original example is 
> actually blocked by something else; I'm just not sure what that is yet.
I went back and looked.  One - of possibly several - cases that were 
giving me trouble was when we had a loop with multiple latches before 
loop-simplify, loop simplify creates a unified latch, and we had not 
peeled the first iteration of the loop when we get to PRE. This creates 
a tree of merges that PRE doesn't deal with.

I took a stab at addressing this with a PRE patch.  It can be found 
here: http://reviews.llvm.org/D7061.  Comments and discussion welcome.

As I should have expected, it turned out to be quite a bit more involved 
that it first looked.  :)

Philip



More information about the llvm-dev mailing list