This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH, PR 32824] Add an additional LIM pass to assist dead code elimination


Hi,
  I have updated the patch to move the existing LIM pass before copyprop/dce in the loop optimizer.
This patch helps eliminate dead code and make the reduction statement vectorizable when the reduction
variable is global. The patch fixes PR 32824.

Note that the problem reported in PR32824 is very popular in fortran code. I am working on Levine benchmark
and found that there are at least 9 such cases.

This patch passed bootstrapping and regression tests. I also tested on spec cpu2006 and found there is no
performance impact.

Is it OK for the trunk?

Thanks,

Changpeng


________________________________________
From: Richard Guenther [richard.guenther@gmail.com]
Sent: Tuesday, March 16, 2010 5:24 AM
To: Fang, Changpeng
Cc: gcc-patches@gcc.gnu.org; rakdver@gcc.gnu.org; spop@gcc.gnu.org
Subject: Re: [PATCH, PR 32824] Add an additional LIM pass to assist dead code   elimination

On Mon, Mar 15, 2010 at 10:14 PM, Fang, Changpeng
<Changpeng.Fang@amd.com> wrote:
> This patch fixes bug 32824: Missed reduction vectorizer after store to global is LIM'd
>
> Patch Description:
> After store to global is LIM'ed, we need a copy propagation and dead code elimination to eliminate
> the dead store in the loop, and thus make the reduction vectorizable. In this patch, I added an additional LIM
> pass at the very beginning of the loop optimizer, then the dead code can be eliminated by pass_dce_loop
> before the vectorizer.
>
> With this patch, the related fortran code (refer to bug 32824 report) can also be vectorized.
>
> I have bootstrapped gcc with the patch and compiled and spec cpu2006 and found no apparent regression
> in both compilation time and spec scores.

I'm not too keen on adding another expensive pass like LIM.  Did you
try simply moving the existing LIM pass before copyprop/dce?

Thanks,
Richard.

> Thanks,
>
> Changpeng
>
>

From f854b7934111ac894c76839833e9be70c6f6c48e Mon Sep 17 00:00:00 2001
From: Changpeng Fang <chfang@pathscale.(none)>
Date: Wed, 17 Mar 2010 09:49:46 -0700
Subject: [PATCH] pr32824

---
 gcc/passes.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gcc/passes.c b/gcc/passes.c
index 9d0c55a..3edac8d 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -885,9 +885,9 @@ init_optimization_passes (void)
 	{
 	  struct opt_pass **p = &pass_tree_loop.pass.sub;
 	  NEXT_PASS (pass_tree_loop_init);
+          NEXT_PASS (pass_lim);
 	  NEXT_PASS (pass_copy_prop);
 	  NEXT_PASS (pass_dce_loop);
-	  NEXT_PASS (pass_lim);
 	  NEXT_PASS (pass_tree_unswitch);
 	  NEXT_PASS (pass_scev_cprop);
 	  NEXT_PASS (pass_record_bounds);
-- 
1.6.3.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]