https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112438
--- Comment #3 from JuzheZhong <juzhe.zhong at rivai dot ai> --- You mean current codegen is bug ? No, I don't think there is a bug in current codegen. It's induction variable. ble a0,zero,.L5 ... vsetvli a3,zero,e32,m1,ta,ma ... vid.v v2 .L3: vsetvli a5,a0,e32,m1,ta,ma ... vadd.vv v1,v1,v2 ... vsetvli a5,zero,e32,m1,ta,ma --- > redundant .. vadd.vv v2,v2,v4 bne a0,zero,.L3 You can see the 'v2' of vadd.vv v1,v1,v2 is either come from the preheader vid, or come from previous iterator 'vadd.vv v2,v2,v4' It's generated by # vect_vec_iv_.6_22 = PHI <_21(4), { 0, 1, 2, ... }(3)> induction variable.