[PATCH] Fix write-back value propagation for pre-indexed addressing modes

Silviu Baranga Silviu.Baranga at arm.com
Wed Apr 24 09:02:01 PDT 2013


Hi,

The attached patch fixes a bug in DAG combiner that causes a wrong usage
of the value write-back value obtained from pre-indexed addressing modes.

The bug manifests itself when the base pointer and the offset are swapped
in a load/store store instruction with a pre decrement addressing mode.

If a user needs to subtract the base from a constant value, the current
code re-writes the expression as a SUB instruction, subtracting the write-back
value from an adjusted constant. This is wrong, since the correct output
is to add an adjusted constant to the write-back value.

Since the code is apparently impossible to test, the patch does not contain a
regression test. Because of this I've re-written the code that handles the
propagation of the write-back value so that it is easy to follow and unlikely
to have fundamental bugs in it.

Please review!

Thanks,
Silviu

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pre_dec_addr.diff
Type: application/octet-stream
Size: 2506 bytes
Desc: pre_dec_addr.diff
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130424/32fe82ce/attachment.obj>


More information about the llvm-commits mailing list