[llvm-commits] patch: partial dse

Nick Lewycky nicholas at mxc.ca
Sun Jan 3 13:56:18 PST 2010


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!

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: partial-dse.patch
Type: text/x-patch
Size: 4855 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100103/2526922f/attachment.bin>


More information about the llvm-commits mailing list