This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] reload1.c: Detect and utilize implicit sets inmove2add. (take 2)
Hi Jim,
> > Attached is a patch to detect implicit sets in move2add and treat such
> > sets identically to explicit sets. This patch is a revised version of
>
> The concept looks OK, however I don't think it is quite right.
>
> Branches can be either
> (if_then_else (ne cond) (pc) (label))
> or
> (if_then_else (ne cond) (label) (pc))
> These mean different things. The first means we fall through if the
> condition is NE. The second means we branch to the label if the
> condition is NE. You need to check for this distinction in your code.
> There is also the issue that
> (if_then_else (eq cond) (pc) (label))
> means the same as
> (if_then_else (ne cond) (label) (pc))
> So you want to accept EQ if pc is operand 1, and NE if pc is operand 2.
I think fis_get_condition handles this problem. Specifically,
fis_get_condition() returns the condition for taking a branch, not the
one for falling through. Here is a comment in fis_get_condition().
/* If this branches to JUMP_LABEL when the condition is false,
reverse the condition. */
> Before the move2add_note_store call, you are duplicating some of the
> tests found in move2add_note_store, specifically, the SCALAR_INT_MODE_P
> and HARD_REGNO_NREGS checks. It isn't clear why you are doing this.
A good point. I will test a version of the patch without those two
lines. (As a second thought, it might be a good idea to avoid a call
to gen_rtx_SET, which allocates memory, by doing some these simple
checks first.)
Kazu Hirata