simplify '(x * -1)' to '-x'
commitf1252a541ac87e814018c0dd01c39ea6356530eb
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Tue, 7 Feb 2017 20:50:26 +0000 (7 21:50 +0100)
committerChristopher Li <sparse@chrisli.org>
Mon, 13 Feb 2017 01:34:46 +0000 (13 09:34 +0800)
treecc6d7a289aaa98cb24405b890e2c0bdf1f63b380
parente6328bea9acbbcd68d6abfad8d9d16a42590e378
simplify '(x * -1)' to '-x'

Currently we simplify multiplication by 1 but nothing is
done for multiplication by -1 which is equivalent to the
negation of its first operand.

This patch add this simplification.

Also add small test cases showing the simplification.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
simplify.c
validation/optim/muldiv-minus-one.c [new file with mode: 0644]