[PATCH] Add Load Combine Pass

Andrew Trick atrick at apple.com
Wed May 7 09:07:24 PDT 2014


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?

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.)

Test cases tend to be more effective with CHECK-LABEL on the name of each subtest.

Otherwise LGTM after addressing Hal's comments. I'm not sure what Hal meant by checking alignment. The new load inherits the alignment of the first aggregated load. We'll end up with an unaligned load as far as the compiler can tell, which is often not optimal. I'm not sure whether combining, then splitting in SelectionDAG will produce worse code or not without trying it. If the mechanism exists to split unaligned loads, can we force that on for x86 and see if we generate worse code in our load combining test cases?

http://reviews.llvm.org/D3580






More information about the llvm-commits mailing list