For m32c-elf with gcc.c-torture/execute/980707-1.c, global seems to be deleting a set that's needed to set the exit code - i.e. it's the first argument to exit(). There's also this suspicious message in the global dump:
changing reg in insn 95 I can't tell if they're changing the pseudo (ok) or $r0 (not ok). Target: m32c-elf command line: ./cc1 -fpreprocessed 980707-1.i -quiet -dumpbase 980707-1.c -dap -msim -mcpu=m32c -auxbase 980707-1 -g -O3 -w -version -fomit-frame-pointer -fno-show-column -fdump-tree-all -o 980707-1.s After local, the rtl looks like this: ;; Start of basic block ( 15) -> 17 ;; bb 17 artificial_defs: { } ;; bb 17 artificial_uses: { u98(7){ }u99(8){ }u100(11){ }} ;; lr in 7 [fb] 8 [sp] 11 [argp] 29 ;; lr use 7 [fb] 8 [sp] 11 [argp] 29 ;; lr def 0 [r0] 6 [sb] 9 [pc] 10 [flg] 12 [mem0] 13 [mem2] 14 [mem4] 15 [mem6] 16 [mem8] 17 [mem10] 18 [mem12] 19 [mem14] ;; live in 7 [fb] 8 [sp] 11 [argp] 29 ;; live gen 0 [r0] ;; live kill ;; Pred edge 15 [0.0%] (code_label 92 91 93 17 23 "" [1 uses]) (note 93 92 94 17 [bb 17] NOTE_INSN_BASIC_BLOCK) (note 94 93 95 17 NOTE_INSN_DELETED) (insn 95 94 96 17 980707-1.i:585 (set (reg:HI 0 r0) (reg:HI 29 [ D.1908 ])) 171 {movhi_op} (expr_list:REG_DEAD (reg:HI 29 [ D.1908 ]) (expr_list:REG_EQUAL (const_int 0 [0x0]) (nil)))) (call_insn 96 95 97 17 980707-1.i:585 (parallel [ (call (mem:QI (symbol_ref:PSI ("exit") [flags 0x41] <function_decl 0xb7f46500 exit>) [0 S1 A8]) (const_int 0 [0x0])) (use (const_int 0 [0x0])) ]) 164 {call} (expr_list:REG_DEAD (reg:HI 0 r0) (expr_list:REG_EH_REGION (const_int 0 [0x0]) (expr_list:REG_NORETURN (const_int 0 [0x0]) (nil)))) (expr_list:REG_DEP_TRUE (use (reg:HI 0 r0)) (nil))) ;; End of basic block 17 -> () ;; lr out 7 [fb] 8 [sp] 11 [argp] ;; live out 7 [fb] 8 [sp] 11 [argp] After global, it's this: ;; Start of basic block ( 15) -> 17 ;; bb 17 artificial_defs: { } ;; bb 17 artificial_uses: { u-1(7){ }u-1(8){ }} ;; lr in 0 [r0] 7 [fb] 8 [sp] ;; lr use 0 [r0] 7 [fb] 8 [sp] ;; lr def 0 [r0] 6 [sb] 9 [pc] 10 [flg] 12 [mem0] 13 [mem2] 14 [mem4] 15 [mem6] 16 [mem8] 17 [mem10] 18 [mem12] 19 [mem14] ;; live in 0 [r0] 7 [fb] 8 [sp] ;; live gen ;; live kill ;; Pred edge 15 [0.0%] (code_label 92 91 93 17 23 "" [1 uses]) (note 93 92 94 17 [bb 17] NOTE_INSN_BASIC_BLOCK) (note 94 93 96 17 NOTE_INSN_DELETED) (call_insn 96 94 97 17 980707-1.i:585 (parallel [ (call (mem:QI (symbol_ref:PSI ("exit") [flags 0x41] <function_decl 0xb7f46500 exit>) [0 S1 A8]) (const_int 0 [0x0])) (use (const_int 0 [0x0])) ]) 164 {call} (expr_list:REG_EH_REGION (const_int 0 [0x0]) (expr_list:REG_NORETURN (const_int 0 [0x0]) (nil))) (expr_list:REG_DEP_TRUE (use (reg:HI 0 r0)) (nil))) ;; End of basic block 17 -> () ;; lr out 8 [sp] ;; live out 8 [sp] Note that the call has the (use) for r0, the argument register. Inspection of the .s file shows that r0 is provably NOT zero (it's last used as an array index), causing many test cases to appear to fail. I can't seem to find why it's doing this, but the code that does the actual deletion is in df-scan.c. Ideas?