[PATCH] Add Load Combine Pass

hfinkel at anl.gov hfinkel at anl.gov
Wed May 7 12:37:18 PDT 2014


----- Original Message -----
> From: "Michael Spencer" <bigcheesegs at gmail.com>
> To: bigcheesegs at gmail.com, atrick at apple.com, chandlerc at gmail.com
> Cc: hfinkel at anl.gov, nrotem at apple.com, aschwaighofer at apple.com, rsilvera at google.com, llvm-commits at cs.uiuc.edu
> Sent: Wednesday, May 7, 2014 2:19:00 PM
> Subject: Re: [PATCH] Add Load Combine Pass
> 
> atrick:
> > It looks like you first sort the loads, then use load[0] as the
> > insertion point. How does this work if the loads are striding
> > backward through memory with uses in between?
> 
> Oops. That is a problem. I did a backward test, but it didn't have a
> use of the value in-between the loads. I suppose I could also store
> the original insertion order...
> 
> > Since you are effectively hoisting loads, I think you should check
> > mayThrow(), not just mayWriteMemory(). In the future, we will want
> > to support read-only calls that mayThrow. (This would allow
> > redundant load elimination across the calls--important for runtime
> > safety checks.)
> 
> I thought only terminating instructions can throw?

*sigh* -- no.

> 
> As for targets that have to split unaligned loads. I tested the
> original case on ARM and llvm actually generates slightly better
> code when SDAG splits the combined load than if we just leave it
> alone. I'll check other targets, but I believe that we do a pretty
> good job splicing. The only bad cases I ran into were where the
> combined load isn't actually used combined, it's just directly
> resplit via shr/trunc. Here I believe we will need to teach SDAG to
> split these loads back up, but that should be easy (but should be
> done before this lands).

Okay.

 -Hal

> 
> http://reviews.llvm.org/D3580
> 
> 
>

http://reviews.llvm.org/D3580






More information about the llvm-commits mailing list