From d9a5f0cc4f16f711ef503be185988b4eb1d230e6 Mon Sep 17 00:00:00 2001 From: Oleg Endo Date: Tue, 13 Jan 2015 00:30:57 +0000 Subject: [PATCH] re PR target/64479 ([SH] wrong optimization delayed-branch) gcc/ PR target/64479 * rtlanal.c (set_reg_p): Handle SEQUENCE constructs. From-SVN: r219506 --- gcc/ChangeLog | 5 +++++ gcc/rtlanal.c | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 89e22ea7ec5..8b86f54573d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-01-13 Oleg Endo + + PR target/64479 + * rtlanal.c (set_reg_p): Handle SEQUENCE constructs. + 2015-01-12 Kaz Kojima * config/sh/sh.c (sh_atomic_assign_expand_fenv): New function. diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index a63bd400c28..4aadac22431 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -1000,6 +1000,17 @@ reg_set_between_p (const_rtx reg, const rtx_insn *from_insn, int reg_set_p (const_rtx reg, const_rtx insn) { + /* After delay slot handling, call and branch insns might be in a + sequence. Check all the elements there. */ + if (INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE) + { + for (int i = 0; i < XVECLEN (PATTERN (insn), 0); ++i) + if (reg_set_p (reg, XVECEXP (PATTERN (insn), 0, i))) + return true; + + return false; + } + /* We can be passed an insn or part of one. If we are passed an insn, check if a side-effect of the insn clobbers REG. */ if (INSN_P (insn) @@ -1011,7 +1022,7 @@ reg_set_p (const_rtx reg, const_rtx insn) GET_MODE (reg), REGNO (reg))) || MEM_P (reg) || find_reg_fusage (insn, CLOBBER, reg))))) - return 1; + return true; return set_of (reg, insn) != NULL_RTX; } -- 2.30.2