[llvm-commits] patch: partial dse

Nick Lewycky nicholas at mxc.ca
Mon Jan 11 09:15:01 PST 2010


Nick Lewycky wrote:
> This patch implements partially-dead store elimination, turning:
>
> %P16 = bitcast i32* %P32 to i16
> store i32 0, i32* %P32
> store i16 -1, i16* %P16
>
> into:
>
> store i32 65535, i32* %P32
>
> Please review!

Having put this patch through its paces, I've concluded that it's buggy 
in a way that can't be fixed without reverse-memdep.

If anyone is interested, doing this transform would help 
consumer-typeset a lot by optimizing accesses to unions in memory (SROA 
already takes care of those on the stack).

Nick

> At the moment, it restricts itself to the case where we have TargetData.
> This seems odd at first, but the problem is that DSE itself doesn't seem
> to be sure how many bits will be modified by a store without it. 'i32'
> and 'i16' are clear, but 'i6' less so (and which 2 bits does it leave
> alone). My opinion is that the only sane behaviour for an i6* store is
> that it overwrite only the first 6 bits of the pointee and no others,
> which is the same rule that i16* and i32* have. However, I know that
> this sort of thing is limited by actual hardware capabilities and wanted
> to ask before I implement :)
>
> It's also restricted to integers. I don't know whether it would be
> profitable to binary-and and binary-or together floats or pointers. We
> could certainly do it in the case where both sides are constant values.
>
> Nick
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list