The problem is
r12-5300-gf98f373dd822b35c allows phiopt to recognize more basic blocks
but missed one location where the basic block does not need to be empty but still
needs to have a single predecessor. This patch fixes that over sight.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR tree-optimization/103317
gcc/ChangeLog:
* tree-ssa-phiopt.c (minmax_replacement): For the non empty
middle bb case, check to make sure it has a single predecessor.
gcc/testsuite/ChangeLog:
* gcc.c-torture/compile/pr103317-1.c: New test.
--- /dev/null
+int a, b;
+char c;
+void
+d (void)
+{
+ char e = c;
+ if (b)
+ if (c < 16 - 11)
+ e = 16 - 11;
+ if (e > 8)
+ e = 8;
+ a = e;
+}
gimple *assign = last_and_only_stmt (middle_bb);
tree lhs, op0, op1, bound;
+ if (!single_pred_p (middle_bb))
+ return false;
+
if (!assign
|| gimple_code (assign) != GIMPLE_ASSIGN)
return false;