This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[3.4/mainline] PR target/15340
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at redhat dot com
- Date: Thu, 24 Jun 2004 22:25:13 +0200
- Subject: [3.4/mainline] PR target/15340
Hi,
In this testcase the sequence:
(insn 69 70 71 1 (set (reg/f:SI 92)
(plus:SI (reg/f:SI 20 frame)
(const_int -1 [0xffffffff]))) 137 {*lea_1} (nil)
(nil))
...
(insn 37 36 40 2 (set (reg/v:SI 63 [ y ])
(sign_extend:SI (mem/s:QI (mult:SI (reg/f:SI 92)
(const_int 2 [0x2])) [0 dir S1 A8]))) 86 {extendqisi2} (nil)
(nil))
gets converted via rematiralization into:
(insn:HI 35 34 46 2 0x4017a39c (set (reg/v:SI 3 ebx [orig:65 y ] [65])
(sign_extend:SI (mem/s:QI (mult:SI (plus:SI (reg/f:SI 6 ebp)
(const_int -13 [0xfffffff3]))
(const_int 2 [0x2])) [0 dir S1 A8]))) 93 {extendqisi2} (nil)
(nil))
and reload does not notice the address being invalid.
Only way to fix this I can think of is to teach find_reload_addresses_1 about
the fact that MULT expr in addressing never contains nested non-trivial
expression (is this valid for all targets not definining custom decomposition
of reload addresses?). This is not completely satisfactory sollution but it is
best I was able to come with.
Regtested i686-pc-gnu-linux, full bootstrap/regtest in progress, OK assuming it passes?
int globl;
void dummy(char arg)
{
globl = arg;
}
int main(int argc, char *argv[])
{
char dir[1];
int y = 0, best;
while (y > *argv[0])
{
best = (int)dir;
y = dir[best];
dummy(*argv[1|best]);
}
return 0;
}
PR target/15340
* reload.c (find_reloads_address_1): Decompose complex MULT expressions.
*** ../../gcc.old/gcc/reload.c Fri Jun 18 18:22:41 2004
--- reload.c Thu Jun 24 17:33:25 2004
*************** find_reloads_address_1 (enum machine_mod
*** 5368,5374 ****
type, ind_levels, insn);
}
}
!
return 0;
case POST_MODIFY:
--- 5368,5392 ----
type, ind_levels, insn);
}
}
! return 0;
! case MULT:
! {
! rtx orig_op0 = XEXP (x, 0);
! rtx orig_op1 = XEXP (x, 1);
! RTX_CODE code0 = GET_CODE (orig_op0);
! RTX_CODE code1 = GET_CODE (orig_op1);
!
! /* As a part of rematerialization process, we possibly inserted non-trivial
! expression as left operand. Expect MULT to be useable only on index
! registers and reload. */
! if (code0 == MULT || code0 == PLUS)
! {
! find_reloads_address_1 (mode, orig_op0, 1, &XEXP (x, 0), opnum,
! type, ind_levels, insn);
! find_reloads_address_1 (mode, orig_op1, 0, &XEXP (x, 1), opnum,
! type, ind_levels, insn);
! }
! }
return 0;
case POST_MODIFY: