[llvm-commits] [PATCH] Smarter unaligned stores of constant values.
Eli Friedman
eli.friedman at gmail.com
Fri Nov 4 16:41:32 PDT 2011
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
More information about the llvm-commits
mailing list