Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr53533-5.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-optimized" } */
3 /* { dg-final { scan-tree-dump-times {(?n)\* 2147483647} 1 "optimized" } } */
4 /* { dg-final { scan-tree-dump-times {(?n)\* 1073741823} 1 "optimized" } } */
5
6 #define INT_MAX 2147483647
7 int
8 foo (int a)
9 {
10 /* When a == -2, there's no overflow for (a + 1) * INT_MAX - 1.
11 but overflow for a * INT_MAX + (INT_MAX - 1).
12 Don't simpify it. */
13 return (a + 1) * INT_MAX - 1;
14 }
15
16 int
17 foo1 (int a)
18 {
19 /* Be conservative here, don't simplify this as long as
20 a * 2147483646 may overflow. */
21 return 1073741823 * (a * 2 + 1);
22 }