[match-and-simplify] fix incorrect code-gen in 'for' pattern

Prathamesh Kulkarni prathamesh.kulkarni@linaro.org
Fri May 15 22:52:00 GMT 2015


Hi,
genmatch generates incorrect code for following (artificial) pattern:

(for op (plus)
      op2 (op)
  (simplify
    (op @x @y)
    (op2 @x @y)

generated gimple code: http://pastebin.com/h1uau9qB
'op' is not replaced in the generated code on line 33:
*res_code = op;

I think it would be a better idea to make op2 iterate over same set
of operators (op2->substitutes = op->substitutes).
I have attached patch for the same.
Bootstrap + testing in progress on x86_64-unknown-linux-gnu.
OK for trunk after bootstrap+testing completes ?

I wonder if we really need is_oper_list flag in user_id ?
We can determine if user_id is an operator list
if user_id::substitutes is not empty ?
That will lose the ability to distinguish between user-defined operator
list and list-iterator in for like op/op2, but I suppose we (so far) don't
need to distinguish between them ?

Thanks,
Prathamesh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-patch
Size: 509 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150515/7e98ff2f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ChangeLog
Type: application/octet-stream
Size: 162 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150515/7e98ff2f/attachment.obj>


More information about the Gcc-patches mailing list