https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95084
Bug ID: 95084 Summary: code sinking prevents if-conversion Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- There's a pass ordering issue between the sink pass and tree-if-conv, if conversion for vectorization. When sink sinks a possibly trapping operation to a place that is only conditionally executed if-conversion fails which results in failed vectorization. This can be seen with https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545588.html applied for gcc.dg/vect/pr56541.c (and it's ifcvt counterpart gcc.dg/tree-ssa/ifc-pr56541.c). But I've also seen this in other context. Here iftmp.2_17 = rR_19 < rL_20 ? rR_19 : rL_20; iftmp.3_3 = rR_19 < rL_20 ? rL_20 : rR_19; if (iftmp.3_3 > 0.0) goto <bb 5>; [INV] else goto <bb 4>; [INV] <bb 4> : <bb 5> : # iftmp.4_14 = PHI <iftmp.2_17(3), 1.5e+2(4)> if (iftmp.4_14 > 0.0) becomes iftmp.3_3 = rR_17 < rL_18 ? rL_18 : rR_17; if (iftmp.3_3 > 0.0) goto <bb 4>; [59.00%] else goto <bb 9>; [41.00%] <bb 9> [local count: 435831803]: goto <bb 6>; [100.00%] <bb 4> [local count: 627172605]: iftmp.2_15 = rR_17 < rL_18 ? rR_17 : rL_18; if (iftmp.2_15 > 0.0) and the now conditionally executed FP comparison can trap.