widening_mul: restrict ops to be defined in the same basic-block when convert plusmin...
authorRichard Biener <rguenther@suse.de>
Thu, 26 Mar 2020 07:33:57 +0000 (08:33 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 26 Mar 2020 07:36:42 +0000 (08:36 +0100)
commitd21dff5b4fee51ae432143065bededfc763dc344
tree4ac6f918374acf8f3992052f73439fabfb5d8254
parent27f8c8c4c9232c16e24030ae056822152fda409d
widening_mul: restrict ops to be defined in the same basic-block when convert plusminus to widen

In the testcase for PR94269, widening_mul moves two multiply
instructions from outside the loop to inside
the loop, merging with two add instructions separately.  This
increases the cost of the loop.  Like FMA detection
in the same pass, simply restrict ops to be defined in the same
basic-block to avoid possibly moving multiply
to a different block with a higher execution frequency.

2020-03-26  Felix Yang  <felix.yang@huawei.com>

PR tree-optimization/94269
* tree-ssa-math-opts.c (convert_plusminus_to_widen): Restrict
this
operation to single basic block.

* gcc.dg/pr94269.c: New test.
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr94269.c [new file with mode: 0644]
gcc/tree-ssa-math-opts.c