[PATCH] ARM: Form paired load after stack coloring.

Quentin Colombet qcolombet at apple.com
Thu Jun 6 17:00:04 PDT 2013


Hi,

** Context **
Recently lifetime markers have been generated by clang in the IR to be able to take advantage of the stack coloring pass.
When these markers are set, the stack coloring pass changes, among other things, the value (setValue) attached to MachineMemoryOperand. In particular, this optimization is setting the value to 0 (<unknown>) when it cannot determine that the value does not alias with a merged alloca (StackColoring.cpp:540).

In the ARM backend, the load/store optimizer checks the presence of this value to decide whether it should form paired load or paired store.

Therefore, the stack coloring pass disables the capabilities of the ARM backend to form paired load or paired store before register allocation.
<rdar://problem/13978317>

** Proposed Solution **
The attached patch removes the dependence of the ARM backend on the value (in fact, this was a false dependency, at least from what I understood).
In particular, it does not change the stack coloring pass, as setting the value to 0 seems the right thing to do for this analysis.

** Test Cases **
The patch adds one test case of a paired load formed when lifetime marker are present (prior to this patch, the paired load is not formed for this test case).
The patch also modifies test/CodeGen/ARM/2012-10-04-AAPCS-byval-align8.ll. Indeed, because of the patch, in that test, we are able to form a paired load before register allocation. Because of a bad interaction with the coalescer, the register allocator is not able to set a proper pair for the paired load. This is causing the pair loaded to be break apart after register allocation.
Prior to this patch, the pair loaded was caught after register allocation, because both copies were coalesced. Anyway, the register allocator has not clue it may form a paired load when coalescing those.
If the patch is accepted, I will file an enhancement request against the register allocator.

** Action Required **
- For Stack coloring pass expert: Confirm that the pass cannot preserve the value of the MachineMemoryOperand. I think the dependence of the ARM back on that is artificial but if we can preserve some information, why not!
- For ARM backend expert: Confirm that the value is not required. Or put differently, what was the purpose checking if  a value was set?

Thanks for the review,

-Quentin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130606/2b014c50/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arm-missed-ldrd.svndiff
Type: application/octet-stream
Size: 3402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130606/2b014c50/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130606/2b014c50/attachment-0001.html>


More information about the llvm-commits mailing list