Working on top of D69252, this adds canonicalisation patterns for ssub.with.overflow to ssub.sats.
These are the alive patterns being selected, all of which pass:
Name: SSub_x_lt0 %ao = ssub_overflow i8 %x, %y %a = extractvalue %ao, 0 %o = extractvalue %ao, 1 %c = icmp slt i8 %x, 0 %s = select i1 %c, i8 -128, i8 127 %x5 = select i1 %o, i8 %s, i8 %a => %x5 = ssub_sat %x, %y Name: SSub_x_lt1 %ao = ssub_overflow i8 %x, %y %a = extractvalue %ao, 0 %o = extractvalue %ao, 1 %c = icmp slt i8 %x, -1 %s = select i1 %c, i8 -128, i8 127 %x5 = select i1 %o, i8 %s, i8 %a => %x5 = ssub_sat %x, %y Name: SSub_x_lg2 ; Not valid. %ao = ssub_overflow i8 %x, %y %a = extractvalue %ao, 0 %o = extractvalue %ao, 1 %c = icmp sgt i8 %x, -2 %s = select i1 %c, i8 127, i8 -128 %x5 = select i1 %o, i8 %s, i8 %a => %x5 = ssub_sat %x, %y Name: SSub_x_lg1 %ao = ssub_overflow i8 %x, %y %a = extractvalue %ao, 0 %o = extractvalue %ao, 1 %c = icmp sgt i8 %x, -1 %s = select i1 %c, i8 127, i8 -128 %x5 = select i1 %o, i8 %s, i8 %a => %x5 = ssub_sat %x, %y Name: SSub_y_lt0 %ao = ssub_overflow i8 %x, %y %a = extractvalue %ao, 0 %o = extractvalue %ao, 1 %c = icmp slt i8 %y, 0 %s = select i1 %c, i8 127, i8 -128 %x5 = select i1 %o, i8 %s, i8 %a => %x5 = ssub_sat %x, %y Name: SSub_y_lt1 %ao = ssub_overflow i8 %x, %y %a = extractvalue %ao, 0 %o = extractvalue %ao, 1 %c = icmp slt i8 %y, 1 %s = select i1 %c, i8 127, i8 -128 %x5 = select i1 %o, i8 %s, i8 %a => %x5 = ssub_sat %x, %y Name: SSub_y_lg0 %ao = ssub_overflow i8 %x, %y %a = extractvalue %ao, 0 %o = extractvalue %ao, 1 %c = icmp sgt i8 %y, 0 %s = select i1 %c, i8 -128, i8 127 %x5 = select i1 %o, i8 %s, i8 %a => %x5 = ssub_sat %x, %y Name: SSub_y_lg1 %ao = ssub_overflow i8 %x, %y %a = extractvalue %ao, 0 %o = extractvalue %ao, 1 %c = icmp sgt i8 %y, -1 %s = select i1 %c, i8 -128, i8 127 %x5 = select i1 %o, i8 %s, i8 %a => %x5 = ssub_sat %x, %y