diff options
author | guojiufu <guojiufu@linux.ibm.com> | 2020-11-17 19:49:03 +0800 |
---|---|---|
committer | guojiufu <guojiufu@linux.ibm.com> | 2020-11-18 13:29:14 +0800 |
commit | d87ee7f1c9cd2ffa6302cdfd0686d72e5bb7463b (patch) | |
tree | c4f1dda5d267c73b2a7a7e1cceffc5b13bdbe7ab /gcc/testsuite/gcc.dg/tree-ssa/loopclosedphi.c | |
parent | 397654d66a4f84d4439e046cd330d9968af3b62b (diff) | |
download | gcc-d87ee7f1c9cd2ffa6302cdfd0686d72e5bb7463b.zip gcc-d87ee7f1c9cd2ffa6302cdfd0686d72e5bb7463b.tar.gz gcc-d87ee7f1c9cd2ffa6302cdfd0686d72e5bb7463b.tar.bz2 |
Clean up loop-closed PHIs after loop finalize
This patch propagates loop-closed PHIs them out at
loop_optimizer_finalize. For some cases, to clean up loop-closed PHIs
would save efforts of optimization passes after loopdone.
Thanks,
Jiufu Guo.
gcc/ChangeLog:
2020-10-18 Jiufu Guo <guojiufu@linux.ibm.com>
* cfgloop.h (loop_optimizer_finalize): Add flag argument.
* loop-init.c (loop_optimizer_finalize): Call clean_up_loop_closed_phi.
* tree-cfgcleanup.h (clean_up_loop_closed_phi): New declare.
* tree-ssa-loop.c (tree_ssa_loop_done): Call loop_optimizer_finalize
with flag argument.
* tree-ssa-propagate.c (clean_up_loop_closed_phi): New function.
gcc/testsuite/ChangeLog:
2020-10-18 Jiufu Guo <guojiufu@linux.ibm.com>
* gcc.dg/tree-ssa/loopclosedphi.c: New test.
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/loopclosedphi.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/loopclosedphi.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loopclosedphi.c b/gcc/testsuite/gcc.dg/tree-ssa/loopclosedphi.c new file mode 100644 index 0000000..d71b757 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/loopclosedphi.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fno-tree-ch -w -fdump-tree-loopdone-details" } */ + +void +t6 (int qz, int wh) +{ + int jl = wh; + + while (1.0 * qz / wh < 1) + { + qz = wh * (wh + 2); + + while (wh < 1) + jl = 0; + } + + while (qz < 1) + qz = jl * wh; +} + +/* { dg-final { scan-tree-dump-times "Replacing" 2 "loopdone"} } */ |