https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67808
Bug ID: 67808 Summary: LRA ICEs on simple double to long double conversion test case Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: bergner at gcc dot gnu.org Target Milestone: --- During a conversion from double to long double, LRA ends up going into a infinite loop spilling things until it hits a threshold and quits with an ICE. The simplest test case I have at the moment is: bergner@genoa:~/gcc/BUGS/LRA/20011123-1$ cat bug2.i void foo (long double *ldb1, double *db1) { *ldb1 = *db1; } bergner@genoa:~/gcc/BUGS/LRA/20011123-1$ /home/bergner/gcc/build/gcc-fsf-mainline-bootstrap-lra-default-debug/gcc/xgcc -B/home/bergner/gcc/build/gcc-fsf-mainline-bootstrap-lra-default-debug/gcc/ -S -O1 -mvsx -S bug2.i bug2.i: In function âfooâ: bug2.i:5:1: internal compiler error: Max. number of generated reload insns per insn is achieved (90) } ^ 0x10962903 lra_constraints(bool) /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/lra-constraints.c:4351 0x10942af7 lra(_IO_FILE*) /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/lra.c:2298 0x108c0ac7 do_reload /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/ira.c:5391 0x108c1183 execute /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/ira.c:5562 After IRA, things are pretty simple, with just the following one insn which needs a reload/spill, since we don't have memory to memory ops on POWER: (insn 7 4 10 2 (parallel [ (set (mem:TF (reg:DI 3 3 [ ldb1 ]) [0 *ldb1_5(D)+0 S16 A128]) (float_extend:TF (mem:DF (reg:DI 4 4 [ db1 ]) [0 *db1_2(D)+0 S8 A64]))) (use (const_double:DF 0.0 [0x0.0p+0])) ]) bug2.i:4 445 {*extenddftf2_internal} (expr_list:REG_DEAD (reg:DI 4 4 [ db1 ]) (expr_list:REG_DEAD (reg:DI 3 3 [ ldb1 ]) (nil)))) In LRA, comes along and gives us the following which looks good: (insn 7 4 11 2 (parallel [ (set (reg:TF 159) (float_extend:TF (mem:DF (reg:DI 4 4 [ db1 ]) [0 *db1_2(D)+0 S8 A64]))) (use (const_double:DF 0.0 [0x0.0p+0])) ]) bug2.i:4 445 {*extenddftf2_internal} (expr_list:REG_DEAD (reg:DI 4 4 [ db1 ]) (expr_list:REG_DEAD (reg:DI 3 3 [ ldb1 ]) (nil)))) (insn 11 7 10 2 (set (mem:TF (reg:DI 3 3 [ ldb1 ]) [0 *ldb1_5(D)+0 S16 A128]) (reg:TF 159)) bug2.i:4 435 {*movtf_64bit_dm} (nil)) But reg 159 was allocated to a VSX_REG and we don't have a TFmode mov* pattern for vsx_reg -> fp_reg copy so we try to copy thru memory which is where we started, so we loop forever until we hit the reload limit and ICE.