[RFC] Should widening_mul should consider block frequency?

Yangfei (Felix) felix.yang@huawei.com
Tue Mar 24 11:36:56 GMT 2020


Hi!

> -----Original Message-----
> From: Richard Biener [mailto:richard.guenther@gmail.com]
> Sent: Monday, March 23, 2020 11:25 PM
> To: Yangfei (Felix) <felix.yang@huawei.com>
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [RFC] Should widening_mul should consider block frequency?
> 
> On Mon, Mar 23, 2020 at 10:53 AM Yangfei (Felix) <felix.yang@huawei.com>
> wrote:
> >
> > Hi,
> >
> >   I created a bug for this issue:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94269
> >   Looks like widening_mul phase may move multiply instruction from outside
> the loop to inside the loop, merging with one add instruction inside the loop.
> >   This will increase the cost of the loop at least on aarch64 (4 cycles vs 1
> cycle).  I think widening_mul should consider block frequency when doing such
> a combination.
> >   I mean something like:
> 
> As written in the PR I'd follow fma generation and restrict defs to the same BB.

Thanks for the suggestion.  That should be more consistent.  
Attached please find the adapted patch.  
Bootstrap and tested on both x86_64 and aarch64 Linux platform.  

gcc:
+2020-03-24  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/testsuite:
+2020-03-24  Felix Yang  <felix.yang@huawei.com>
+
+       PR tree-optimization/94269
+       * gcc.dg/pr94269.c: New test.
+

Thanks,
Felix
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr94269-v1.patch
Type: application/octet-stream
Size: 2089 bytes
Desc: pr94269-v1.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20200324/3ed7f6d9/attachment-0001.obj>


More information about the Gcc-patches mailing list