https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84826
sudi at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ebotcazou at gcc dot gnu.org --- Comment #3 from sudi at gcc dot gnu.org --- So I looked into this. Turns out the actual issue is that USE_RETURN_INSN (FALSE) changes its value and becomes false after pass ce3. According to what I can see, arm_r3_live_at_start_p() starts to return true after ce3. +static bool +arm_r3_live_at_start_p (void) +{ + /* Just look at cfg info, which is still close enough to correct at this + point. This gives false positives for broken functions that might use + uninitialized data that happens to be allocated in r3, but who cares? */ This particular test cares :P + return REGNO_REG_SET_P (df_get_live_out (ENTRY_BLOCK_PTR_FOR_FN (cfun)), 3); +} r3 in this test case is being allocated for b and after ifcvt, it becomes partially defined and thus the liveness does not get killed. (Look below for excerpt from ce3) ;; lr in 0 [r0] 3 [r3] 12 [ip] 13 [sp] 14 [lr] ;; lr use 0 [r0] 3 [r3] 12 [ip] 13 [sp] ;; lr def 100 [cc] ;; live in 0 [r0] 3 [r3] 12 [ip] 13 [sp] 14 [lr] ;; live gen 3 [r3] 100 [cc] ;; live kill (note 5 1 47 2 [bb 2] NOTE_INSN_BASIC_BLOCK) (note 47 5 2 2 NOTE_INSN_PROLOGUE_END) (note 2 47 4 2 NOTE_INSN_DELETED) (note 4 2 7 2 NOTE_INSN_FUNCTION_BEG) (insn 7 4 10 2 (set (reg:CC 100 cc) (compare:CC (reg:SI 0 r0 [ cD.5556 ]) (const_int 0 [0]))) "ice.i":6 193 {*arm_cmpsi_insn} (expr_list:REG_DEAD (reg:SI 0 r0 [ cD.5556 ]) (nil))) (insn 10 7 11 2 (cond_exec (ne (reg:CC 100 cc) (const_int 0 [0])) (set (reg:SI 3 r3 [orig:115 CHAIN.1_5(D)->bD.5567 ] [115]) (mem/j:SI (reg/f:SI 12 ip [orig:113 CHAIN.1D.5566 ] [113]) [1 CHAIN.1_5(D)->bD.5567+0 S4 A32]))) "ice.i":7 4068 {*p *arm_movsi_vfp} (expr_list:REG_EQUIV (mem/j:SI (reg/f:SI 12 ip [orig:113 CHAIN.1D.5566 ] [113]) [1 CHAIN.1_5(D)->bD.5567+0 S4 A32]) (nil))) My question is: 1) Is there any easy way to avoid the false positives from arm_r3_live_at_start_p() 2) Why is r3 still live at IN of BB2 when there is no reaching definition of it? I mean also there will never be any reaching definition at IN of BB2. So shouldn't all the liveness (barring the artificially create ones for the prologues/stack requirements) be killed there? I know I may be over simplifying all the intricate details of liveness analysis when I ask this question, but I am looking for some help here!