This is the mail archive of the
mailing list for the GCC project.
RE: [PATCH, combine] Try REG_EQUAL for nonzero_bits
- From: "Thomas Preud'homme" <thomas dot preudhomme at arm dot com>
- To: "'Jeff Law'" <law at redhat dot com>, "'Eric Botcazou'" <ebotcazou at adacore dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 5 May 2015 11:29:08 +0800
- Subject: RE: [PATCH, combine] Try REG_EQUAL for nonzero_bits
- Authentication-results: sourceware.org; auth=none
- References: <000001d00546$33445430$99ccfc90$ at arm dot com> <1667449 dot SiF8mNp2oU at polaris> <000601d015e4$3915ef50$ab41cdf0$ at arm dot com> <2389505 dot JqqgOpb7ZL at polaris> <00f101d044d5$51ddaf30$f5990d90$ at arm dot com> <553A92C1 dot 10603 at redhat dot com> <000901d080d4$aa49a6c0$fedcf440$ at arm dot com> <553E6359 dot 2030509 at redhat dot com>
> From: Jeff Law [mailto:firstname.lastname@example.org]
> Sent: Tuesday, April 28, 2015 12:27 AM
> OK. No need for heroics -- give it a shot, but don't burn an insane
> amount of time on it. If we can't get to a reasonable testcase, then so
> be it.
Ok, I tried but really didn't managed to create a testcase. I did, however,
understand the condition when this patch is helpful. In the function
reg_nonzero_bits_for_combine () in combine.c there is a test to check if
last_set_nonzero_bits for a given register is still valid.
In the case I'm considering, the test evaluates to false because:
(i) the register rX whose nonzero bits are being evaluated was set in a
previous basic block than the one with the instruction using rX (hence
rsp->last_set_label < label_tick)
(ii) the predecessor of the the basic block for that same insn is not the
previous basic block analyzed by combine_instructions (hence
label_tick_ebb_start == label_tick)
(iii) the register rX is set multiple time (hence
REG_N_SETS (REGNO (x)) != 1)
Yet, the block being processed is dominated by the SET for rX so there
is a REG_EQUAL available to narrow down the set of nonzero bits.
Based on my understanding of your answer quoted above, I'll commit
it as is, despite not having been able to come up with a testcase. I'll
wait tomorrow to do so though in case you changed your mind about it.