/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized-details-blocks --param logical-op-non-short-circuit=1" } */
+/* Disable phi-opt as it is no longer confused by predicate which had allowed ifcombine to work in the past.
+ Note this testcase is about ifcombine rather than phi-opt. */
+/* { dg-options "-O1 -fdump-tree-optimized-details-blocks --param logical-op-non-short-circuit=1 -fno-ssa-phiopt" } */
_Bool f1(_Bool a, _Bool b)
{
if (!gimple_seq_empty_p (phi_nodes (bb)))
return false;
- stmt_to_move = last_and_only_stmt (bb);
+ gimple_stmt_iterator gsi;
+
+ gsi = gsi_start_nondebug_after_labels_bb (bb);
+ while (!gsi_end_p (gsi))
+ {
+ gimple *s = gsi_stmt (gsi);
+ gsi_next_nondebug (&gsi);
+ /* Skip over Predict and nop statements. */
+ if (gimple_code (s) == GIMPLE_PREDICT
+ || gimple_code (s) == GIMPLE_NOP)
+ continue;
+ /* If there is more one statement return false. */
+ if (stmt_to_move)
+ return false;
+ stmt_to_move = s;
+ }
+
+ /* The only statement here was a Predict or a nop statement
+ so return true. */
if (!stmt_to_move)
- return false;
+ return true;
if (gimple_vuse (stmt_to_move))
return false;