There could be several identical PHIs in exit block using same loop recurrence.
For example, we have a following 2 phis in the loop, both %local_2_23 and %local_4_25 values are not used inside the loop.
loop: %local_2_23 = phi i32 [ %iv.rem, %loop ], [ %43, %preheader ] %local_4_25 = phi i32 [ %iv.rem, %loop ], [ -25, %preheader ]
LCSSA will produce two corresponding phis in exit block.
loop.exit: %local_2_23.lcssa = phi i32 [ %local_2_23, %loop ] %local_4_25.lcssa = phi i32 [ %local_4_25, %loop ]
Further passes may deduce that these depend only on iv value hence we may end up with the identical phi nodes in loop exit block.
loop: %iv.rem185 = phi i32 [ 7, %preheader ], [ %iv.rem, %loop ] ... loop_exit: %local_2_23.lcssa = phi i32 [ %iv.rem185, %loop ] %local_4_25.lcssa = phi i32 [ %iv.rem185, %loop ]
When LV is fixing recurrence users, only the first phi is handled.