This fixes a bug related to LSR PHI node elimination.
In the touching case, LSR should not eliminate %lsr.iv30, it is not congruent with %lsr.iv99. Their start value are not same.
But for now, Scalar Evolution returns same SCEVUnknown SCEV to them. This should be a bug for scalar evolution.
%scevgep26 = getelementptr [0 x %_elem_type_of_ap], [0 x %_elem_type_of_ap]* %.ap, i64 0, i64 28 %scevgep2627 = bitcast %_elem_type_of_ap* %scevgep26 to [0 x %_elem_type_of_ap]* %lsr.iv30 = phi [0 x %_elem_type_of_ap]* [ %24, %_scf_2_skip_ ], [ %scevgep2627, %_loop_1_do_.lr.ph ] %scevgep97 = getelementptr [0 x %_elem_type_of_ap], [0 x %_elem_type_of_ap]* %.ap, i64 0, i64 -1 %scevgep9798 = bitcast %_elem_type_of_ap* %scevgep97 to [0 x %_elem_type_of_ap]* %lsr.iv99 = phi [0 x %_elem_type_of_ap]* [ %24, %_scf_2_skip_ ], [ %scevgep9798, %_loop_1_do_.lr.ph ]
This patch solves the issue when Scalar Evolution wrongly returns the same SCEVUnknown SCEV object for two Values.
But of course, we should find out the bug inside scalar evolution and fix it there.
Here we make some protection when Scalar Evolution gets some bug and will meet functionality issues.
clang-format: please reformat the code