/* Inspired by 'libgomp.oacc-c-c++-common/nvptx-sese-1.c'. */ /* { dg-additional-options -O1 } */ /* { dg-additional-options -fdump-tree-dom3-raw } */ extern int __attribute__((const)) foo1 (int); int f1 (int r) { if (foo1 (r)) /* If this first 'if' holds... */ r *= 2; /* ..., 'r' now has a zero-value lower-most bit... */ if (r & 1) /* ..., so this second 'if' can never hold... */ { /* ..., so this is unreachable. */ /* In constrast, if the first 'if' does not hold ('foo1 (r) == 0'), the second 'if' may hold, but we know ('foo1' being 'const') that 'foo1 (r) == 0', so don't have to re-evaluate it here: */ r += foo1 (r); } return r; } /* Thus, if optimizing, we only ever expect one call of 'foo1'. { dg-final { scan-tree-dump-times {gimple_call > 1) & 2) r += foo4 (r); return r; } /* { dg-final { scan-tree-dump-times {gimple_call