Looks like Honza messed up the return value for __builtin_unreachable/__builtin_trap
in unlikely_executed_stmt_p (with
r16-2639-g1d3e713dda99e2). These are inserted
by the user or optimizers but they are always unlikely. So fix the return value
to be true for these.
A minor update to gcc.target/i386/pr121572-1a.c is needed as the never executed
predicate causes the trap instruction (ud2) to be in a new partition which interfers
with the dg-final check-body check. Also the code generation goes back to what it
was in GCC 15 also.
Bootstrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
* predict.cc (unlikely_executed_stmt_p): Fix up return for
__builtin_unreachable/__builtin_trap.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr121572-1a.c: Turn off -freorder-blocks-and-partition
as it interferes with the check-body.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
if (gimple_call_builtin_p (stmt, BUILT_IN_UNREACHABLE)
|| gimple_call_builtin_p (stmt, BUILT_IN_UNREACHABLE_TRAP)
|| gimple_call_builtin_p (stmt, BUILT_IN_TRAP))
- return false;
+ return true;
/* Checks below do not need to be fully reliable. Cold attribute may be
misplaced by user and in the presence of comdat we may result in call to
extern void use_cache (int);
extern int val (int v);
-__attribute__ ((optimize (2)))
+__attribute__ ((optimize (2,"-fno-reorder-blocks-and-partition")))
void
bug (void)
{