https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112447
--- Comment #11 from Vineet Gupta <vineetg at gcc dot gnu.org> --- As a hack I commented out set_delete() to see what the extraneous vsetvli would have been. ``` .L36: # bb 3: start of outer loop: off 0 vsetvli zero,zero,e8,mf2,ta,ma # insn 2915 vse8.v v1,0(t3) # insn 2874, bb 3 vse8.v v1,0(t6) vse8.v v1,0(s0) ... # bb 181 addi a4,a4,1 li a7,15 bne a4,a7,.L36 # insn 1082 # bb 182: start of outer loop: off 1 vsetvli zero,zero,e32,mf2,ta,ma # insn 2919 vmv.x.s a3,v1 # insn 1858 vsetvli zero,zero,e16,mf2,ta,ma sw a3,8(sp) vmv.x.s a3,v1 ``` Essentially phase 2 is fusing vsetvl info for insn 2874 and insn 1858 But the fused info doesn't seem right. vsetvli zero,zero,e32,m2,ta,ma j .L36 Manually modifying it to orig value fixes the test. vsetvli zero,zero,e8,mf2,ta,ma j .L36 Phase 2 logs ``` Try lift up 1. earliest: Edge(bb 0 -> bb 2): n_bits = 13, set = {0 } Edge(bb 62 -> bb 63): n_bits = 13, set = {4 } Edge(bb 180 -> bb 181): n_bits = 13, set = {8 } Edge(bb 181 -> bb 3): n_bits = 13, set = {2 } Fuse curr info since prev info compatible with it: prev_info: VALID (insn 1858, bb 181) <-- due to Edge(bb 181 -> bb 3) Demand fields: demand_sew_only SEW=32, VLMUL=mf2, RATIO=64, MAX_SEW=64 TAIL_POLICY=agnostic, MASK_POLICY=agnostic AVL=(nil) VL=(nil) curr_info: VALID (insn 2874, bb 3) Demand fields: demand_ratio_only demand_avl SEW=8, VLMUL=mf2, RATIO=16, MAX_SEW=64 TAIL_POLICY=agnostic, MASK_POLICY=agnostic AVL=(const_int 8 [0x8]) VL=(nil) prev_info after fused: VALID (insn 1858, bb 181) Demand fields: demand_sew_lmul demand_avl SEW=32, VLMUL=m2, RATIO=16, MAX_SEW=64 TAIL_POLICY=agnostic, MASK_POLICY=agnostic AVL=(const_int 8 [0x8]) VL=(nil) ``` This fuse in turn is happening from DEF_SEW_LMUL_RULE (sew_only, ratio_only, sew_lmul, next_ratio_valid_for_prev_sew_p, always_false, modify_lmul_with_next_ratio) I'm not really sure if the merge callback here is correct.