The vector-compare-1.c testcase fails on S/390 when compiled with -march=z196 Steps to reproduce: make check-gcc RUNTESTFLAGS="--target_board='unix/-m31/-march=z196' dg-torture.exp=vector-compare-1.c" FAIL: c-c++-common/torture/vector-compare-1.c -O3 -fomit-frame-pointer execution test FAIL: c-c++-common/torture/vector-compare-1.c -O3 -fomit-frame-pointer -funroll-loops execution test FAIL: c-c++-common/torture/vector-compare-1.c -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions execution test FAIL: c-c++-common/torture/vector-compare-1.c -O3 -g execution test lra-remat places an insn (14287) which reads and clobbers the condition code hard register 33 right after (insn 1330) each other making the second depend on the clobbered cc. IRA: ;; basic block 134, loop depth 0, count 0, freq 619, maybe hot ;; prev block 133, next block 135, flags: (RTL) ;; pred: 133 [100.0%] (FALLTHRU) ;; bb 134 artificial_defs: { } ;; bb 134 artificial_uses: { u1044(11){ }u1045(15){ }u1046(32){ }u1047(34){ }} ;; lr in 11 [%r11] 14 [%r14] 15 [%r15] 32 [%ap] 34 [%fp] 109 110 2132 2134 2268 2311 6202 6445 6446 6447 6448 6449 6450 ;; lr use 11 [%r11] 15 [%r15] 32 [%ap] 34 [%fp] 6202 6446 6449 ;; lr def 33 [%cc] 116 2317 2318 (note 1327 1326 1329 134 [bb 134] NOTE_INSN_BASIC_BLOCK) (insn 1329 1327 1330 134 (parallel [ (set (reg:CCL3 33 %cc) (compare:CCL3 (reg:SI 6446 [ D.2538 ]) (reg:SI 6449 [ D.2538 ]))) (clobber (scratch:SI)) ]) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 380 {*subsi3_cconly2} (nil)) (insn 1330 1329 1328 134 (parallel [ (set (reg:SI 2317 [ D.2534+-3 ]) (geu:SI (reg:CCL3 33 %cc) (const_int 0 [0]))) (clobber (reg:CC 33 %cc)) ]) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 413 {*scondsi} (expr_list:REG_DEAD (reg:CCL3 33 %cc) (expr_list:REG_UNUSED (reg:CC 33 %cc) (nil)))) (insn 1328 1330 1331 134 (set (reg:SI 116 [ D.2533 ]) (const_int -1 [0xffffffffffffffff])) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 68 {*movsi_esa} (nil)) (insn 1331 1328 1332 134 (parallel [ (set (reg:SI 2318 [ D.2533 ]) (neg:SI (reg:SI 2317 [ D.2534+-3 ]))) (clobber (reg:CC 33 %cc)) ]) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 490 {*negsi2} (expr_list:REG_DEAD (reg:SI 2317 [ D.2534+-3 ]) (expr_list:REG_UNUSED (reg:CC 33 %cc) (nil)))) (insn 1332 1331 1333 134 (set (reg:CCZ 33 %cc) (compare:CCZ (reg:SI 6202 [ D.2537+4 ]) (reg:SI 2318 [ D.2533 ]))) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 26 {*cmpsi_cct} (expr_list:REG_DEAD (reg:SI 2318 [ D.2533 ]) (expr_list:REG_EQUAL (compare:CCZ (const_int -1 [0xffffffffffffffff]) (reg:SI 2318 [ D.2533 ])) (nil)))) (jump_insn 1333 1332 1334 134 (set (pc) (if_then_else (ne (reg:CCZ 33 %cc) (const_int 0 [0])) (label_ref:SI 9319) (pc))) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 598 {*cjump_64} (expr_list:REG_DEAD (reg:CCZ 33 %cc) (int_list:REG_BR_PROB 4 (nil))) -> 9319) RELOAD: ;; basic block 134, loop depth 0, count 0, freq 619, maybe hot ;; prev block 133, next block 135, flags: (REACHABLE, RTL, MODIFIED) ;; pred: 133 [100.0%] (FALLTHRU) ;; bb 134 artificial_defs: { } ;; bb 134 artificial_uses: { u-1(11){ }u-1(15){ }} ;; lr in 0 [%r0] 1 [%r1] 3 [%r3] 4 [%r4] 5 [%r5] 6 [%r6] 7 [%r7] 8 [%r8] 9 [%r9] 10 [%r10] 11 [%r11] 12 [%r12] 14 [%r14] 15 [%r15] 34 [%fp] ;; lr use 6 [%r6] 9 [%r9] 10 [%r10] 11 [%r11] 15 [%r15] ;; lr def 2 [%r2] 33 [%cc] ;; live in 0 [%r0] 1 [%r1] 3 [%r3] 4 [%r4] 5 [%r5] 6 [%r6] 7 [%r7] 8 [%r8] 9 [%r9] 10 [%r10] 11 [%r11] 12 [%r12] 14 [%r14] 15 [%r15] 34 [%fp] ;; live gen 2 [%r2] 33 [%cc] ;; live kill 2 [%r2] 33 [%cc] (note 1327 1326 12665 134 [bb 134] NOTE_INSN_BASIC_BLOCK) (insn 12665 1327 1329 134 (set (reg:SI 2 %r2 [6924]) (reg:SI 9 %r9 [orig:6446 D.2538 ] [6446])) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 68 {*movsi_esa} (nil)) (insn 1329 12665 1330 134 (parallel [ (set (reg:CCL3 33 %cc) (compare:CCL3 (reg:SI 2 %r2 [6924]) (reg:SI 10 %r10 [orig:6449 D.2538 ] [6449]))) (clobber (reg:SI 2 %r2 [6924])) ]) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 380 {*subsi3_cconly2} (nil)) (insn 1330 1329 14273 134 (parallel [ (set (reg:SI 2 %r2 [orig:2317 D.2534+-3 ] [2317]) (geu:SI (reg:CCL3 33 %cc) (const_int 0 [0]))) (clobber (reg:CC 33 %cc)) ]) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 413 {*scondsi} (nil)) (note 14273 1330 14280 134 NOTE_INSN_DELETED) (note 14280 14273 14117 134 NOTE_INSN_DELETED) (note 14117 14280 1328 134 NOTE_INSN_DELETED) (insn 1328 14117 14286 134 (set (reg:SI 2 %r2 [orig:116 D.2533 ] [116]) (const_int -1 [0xffffffffffffffff])) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 68 {*movsi_esa} (nil)) (insn 14286 1328 14287 134 (set (mem/c:SI (plus:SI (reg/f:SI 11 %r11) (const_int 464 [0x1d0])) [6 %sfp+-40 S4 A32]) (reg:SI 2 %r2 [orig:116 D.2533 ] [116])) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 68 {*movsi_esa} (nil)) (insn 14287 14286 14272 134 (parallel [ (set (reg:SI 2 %r2 [orig:2317 D.2534+-3 ] [2317]) (geu:SI (reg:CCL3 33 %cc) (const_int 0 [0]))) (clobber (reg:CC 33 %cc)) ]) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 413 {*scondsi} (nil)) (note 14272 14287 1331 134 NOTE_INSN_DELETED) (insn 1331 14272 14271 134 (parallel [ (set (reg:SI 2 %r2 [orig:2318 D.2533 ] [2318]) (neg:SI (reg:SI 2 %r2 [orig:2317 D.2534+-3 ] [2317]))) (clobber (reg:CC 33 %cc)) ]) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 490 {*negsi2} (nil)) (insn 14271 1331 14279 134 (set (reg:SI 2 %r2 [orig:2318 D.2533 ] [2318]) (reg:SI 2 %r2 [orig:2318 D.2533 ] [2318])) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 68 {*movsi_esa} (nil)) (note 14279 14271 14116 134 NOTE_INSN_DELETED) (note 14116 14279 1332 134 NOTE_INSN_DELETED) (insn 1332 14116 1333 134 (set (reg:CCZ 33 %cc) (compare:CCZ (reg:SI 6 %r6 [orig:6202 D.2537+4 ] [6202]) (reg:SI 2 %r2 [orig:2318 D.2533 ] [2318]))) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 26 {*cmpsi_cct} (expr_list:REG_EQUAL (compare:CCZ (const_int -1 [0xffffffffffffffff]) (reg:SI 2 %r2 [orig:2318 D.2533 ] [2318])) (nil))) (jump_insn 1333 1332 1334 134 (set (pc) (if_then_else (ne (reg:CCZ 33 %cc) (const_int 0 [0])) (label_ref:SI 9319) (pc))) /home/andreas/gcc/gcc/testsuite/c-c++-common/torture/vector-compare-1.c:54 598 {*cjump_64} (int_list:REG_BR_PROB 4 (nil)) -> 9319)
Andreas, thanks for the analysis. The rematerialized insn should be not a candidate. A check exists for this in la-remat.c but still it happens. I'll investigate this more on Monday and definitely fix it on the next week as this is a serious problem.
Author: vmakarov Date: Tue Feb 24 18:11:38 2015 New Revision: 220946 URL: https://gcc.gnu.org/viewcvs?rev=220946&root=gcc&view=rev Log: 2015-02-24 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/65123 * lra-remat.c (operand_to_remat): Check hard regs in insn definition too. Modified: trunk/gcc/ChangeLog trunk/gcc/lra-remat.c
Fixed, thanks.