[PATCH] improve ifcvt optimization (PR rtl-optimization/89430)
JiangNing OS
jiangning@os.amperecomputing.com
Fri Mar 15 08:22:00 GMT 2019
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.
Thanks,
-Jiangning
-------------- next part --------------
A non-text attachment was scrubbed...
Name: csel3.patch
Type: application/octet-stream
Size: 18938 bytes
Desc: csel3.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190315/35ccd5dc/attachment.obj>
More information about the Gcc-patches
mailing list