[LLVMdev] AArch64AddressTypePromotion does nothing (was Re: Contributing the Apple ARM64 compiler backend)
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Jun 30 16:53:28 PDT 2014
> On 2014-Jun-30, at 16:19, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
>
>
>> On 2014-Jun-27, at 16:30, Jim Grosbach <grosbach at apple.com> wrote:
>>
>> AArch64AddressTypePromotion.cpp does a fair bit of work to help make these things work out well. It could probably be generalized for non-AArch64 targets as per the comment in the file header.
>
> I spent some time today generalizing AArch64AddressTypePromotion (I'll
> send the patches when they're ready), but in the process discovered
> that this pass does nothing (!) right now. I assume this bug was
> introduced when we changed the semantics of `Use` (IIRC, ARM64 was
> still private at the time).
>
> After the tiny patch inline below, the code looks even better:
>
> --- old.s 2014-06-30 16:12:52.000000000 -0700
> +++ new.s 2014-06-30 16:13:24.000000000 -0700
> @@ -5,12 +5,10 @@
> _foo: ; @foo
> .cfi_startproc
> ; BB#0: ; %entry
> - add w8, w1, #1 ; =1
> - add w9, w1, #2 ; =2
> - ldr w8, [x0, w8, sxtw #2]
> - ldr w9, [x0, w9, sxtw #2]
> - add w8, w9, w8
> - str w8, [x0, w1, sxtw #2]
> + add x8, x0, w1, sxtw #2
> + ldp w9, w10, [x8, #4]
> + add w9, w10, w9
> + str w9, [x8]
> ret
> .cfi_endproc
>
> I'll commit the fix once I've written up a testcase.
FYI, I committed this as r212073.
I'll do a quick audit of other calls of `uses()` and `use_begin()` in
AArch64.
More information about the llvm-dev
mailing list