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

Lang Hames lhames at gmail.com
Fri Nov 4 16:30:04 PDT 2011


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)

Cheers,
Lang.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111104/8902373f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: legalizer.patch
Type: application/octet-stream
Size: 2105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111104/8902373f/attachment.obj>


More information about the llvm-commits mailing list