Starting from revision 160625 (http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01155.html) if-conversion generates redundant statements for
for (i = 0; i < N; i++) if (arr[i] < limit) { pos = i + 1; limit = arr[i]; } # pos_22 = PHI <pos_1(4), 1(2)> # i_23 = PHI <prephitmp.8_2(4), 0(2)> # limit_24 = PHI <limit_4(4), 1.28e+2(2)> # ivtmp.9_18 = PHI <ivtmp.9_17(4), 64(2)> limit_9 = arr[i_23]; pos_10 = i_23 + 1; D.4534_12 = limit_9 < limit_24; <----- pretmp.7_3 = i_23 + 1; D.4535_20 = limit_9 >= limit_24; <----- pos_1 = [cond_expr] limit_9 >= limit_24 ? pos_22 : pos_10; limit_4 = [cond_expr] limit_9 >= limit_24 ? limit_24 : limit_9; prephitmp.8_2 = [cond_expr] limit_9 >= limit_24 ? pretmp.7_3 : pos_10; ivtmp.9_17 = ivtmp.9_18 - 1; D.4536_19 = D.4534_12 || D.4535_20; <----- if (ivtmp.9_17 != 0) goto <bb 4>; else goto <bb 5>; The statements are removed by later dce pass, but they interfere with my attempts to vectorize this loop. -- Summary: If-conversion generates redundant statements Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: irar at il dot ibm dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44710