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: [RFC] new post-reload compare elimination pass


On 11/29/10 16:39, Richard Henderson wrote:
Since NickC is away for the next month or so, I spent some of the
long weekend trying to help him out with the mn10300 comparison
problem for which he's already sent two revisions.  The patch is
along the lines I proposed here:

http://gcc.gnu.org/ml/gcc-patches/2010-11/msg01076.html

This adds a new post-reload pass, which is only enabled by backends
that require it, e.g.

+  /* Enable comparison elimination, unless explicitly disabled.  */
+  if (optimize&&  !global_options_set.x_flag_compare_elim_after_reload)
+    flag_compare_elim_after_reload = 1;
as will be seen in the mn10300 backend patch that uses this.

I tried to use the df.h interfaces more, but I couldn't seem to find
any easy way to walk a def-def chain.  I'd need that to easily notice
the LUID of the clobber of the flags register preceding a compare.  In
the end it seemed easiest to simply walk the insn chain and keep track.

Comments wrt this specific patch?
At first glance this reminded me a lot of the old comparison elimination code in final, as it should since the code we want to generate is the same -- the major difference is this code twiddles the RTL to match reality where the old code waited until it was late enough on the pipeline that it could just change the assembly code without downstream consequences.

With that in mind, I looked over the old code in final.c to see if there were any high level gotchas -- the only ones that stuck out where checks to ensure the comparison didn't have a volatile operand or an operand with an auto-increment addressing mode. I don't see similar checks in your new pass.

I don't think it's necessary right now, but handling conditional moves, conditional traps & setcc insns might be useful one day as well.

Overall, the pass looks pretty simple. I presume you verified it actually eliminated some comparisons on the mn103 port? Did NickC give you a testcase or two to work with?

Jeff



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