[PATCH] improve ifcvt optimization (PR rtl-optimization/89430)

JiangNing OS jiangning@os.amperecomputing.com
Mon Jun 17 00:36:00 GMT 2019


Hi,

May I know any feedback comments to this patch?

Thanks,
-Jiangning

From: Kyrill Tkachov <kyrylo.tkachov@foss.arm.com>
Sent: Friday, May 24, 2019 10:55 PM
To: JiangNing OS <jiangning@os.amperecomputing.com>; gcc-patches@gcc.gnu.org
Cc: ebotcazou@adacore.com; steven@gcc.gnu.org; law@redhat.com
Subject: Re: [PATCH] improve ifcvt optimization (PR rtl-optimization/89430)


Hi Jiangning
On 3/15/19 4:46 AM, JiangNing OS wrote:
This patch is to fix a missing ifcvt opportunity in back-end. For the simple case below,

if (...)
    x = a;  /* x is memory */
/* no else */

We can generate conditional move and remove the branch as below if the target cost is acceptable.

r1 = x
r2 = a
cmp ...
csel r3, r1, r2, cond
x = r3

This could be safe if x is a stack variable, and there isn't any address taken in current function, so the store speculation can be avoided.

In practice, this optimization can improve a real application performance by %4 on aarch64.



Now that GCC 10 development is open, this should appropriate for considering.

I've cc'ed folks who are either listed maintainers in this area or have reviewed patches in this area in my recent memory.

Thanks,

Kyrill


Thanks,
-Jiangning



More information about the Gcc-patches mailing list