[llvm-commits] [PATCH] Smarter unaligned stores of constant values.

Lang Hames lhames at gmail.com
Mon Nov 7 17:09:17 PST 2011


Ok - this patch adds a ISD::Constant case to GetDemandedBits. I went for
this over SimplifyDemandedBits, since the latter expects single-use
operands, and the aim here is to re-use the constant.

The effect on the test case from the first email is the same.

Please let me know what you think.

Cheers,
Lang.


On Fri, Nov 4, 2011 at 4:58 PM, Lang Hames <lhames at gmail.com> wrote:

> Thanks Eli! Looking into SimplifyDemandedBits now...
>
> Cheers,
> Lang.
>
> On Fri, Nov 4, 2011 at 4:41 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
>
>> On Fri, Nov 4, 2011 at 4:30 PM, Lang Hames <lhames at gmail.com> wrote:
>> > Encountered the following when I tried outputting an unaligned store of
>> -1
>> > on ARM:
>> > _foo:                                   @ @foo
>> > @ BB#0:                                 @ %entry
>> >         mov     r1, #255
>> >         mov     r2, #255
>> >         strb    r1, [r0, #3]
>> >         orr     r1, r2, #65280
>> >         strb    r1, [r0, #2]
>> >         mvn     r1, #-16777216
>> >         strb    r1, [r0, #1]
>> >         mvn     r1, #0
>> >         strb    r1, [r0]
>> >         mov     pc, lr
>> > The strange constants are coming out of the legalizer, which tries to
>> > legalize the unaligned store by repeatedly splitting it into two
>> half-sized
>> > stores, and shifting the constant around. This results in several new
>> and
>> > confusing constants being introduced.
>> > This patch checks for constant value stores, and if the two halves of
>> the
>> > constant have the same bit-pattern it avoids creating new constants.
>> > Could someone who's more familiar with the legalizer take a look and
>> let me
>> > know if this is Ok to commit?  (I'm also planning to enable unaligned
>> stores
>> > on supported subtargets, but that's a different issue)
>>
>> TargetLowering::SimplifyDemandedBits should be able to take care of
>> this; if it can't, it should be fixed.
>>
>> -Eli
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111107/54a6a18e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dagcombiner.patch
Type: application/octet-stream
Size: 849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111107/54a6a18e/attachment.obj>


More information about the llvm-commits mailing list