Debian Codegraph @

gcc/testsuite/g++.dg/tree-ssa/pr115275.C

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3
4 /* PR tree-optimization/115275 */
5
6 template<class T>
7 inline const T &
8 min(const T &a, const T &b)
9 {
10 return a < b ? a : b;
11 }
12
13 template<class T>
14 inline const T &
15 max(const T &a, const T &b)
16 {
17 return a < b ? b : a;
18 }
19
20
21 unsigned short m, a, b;
22 void removeme ();
23 void fn(unsigned short f) {
24 if(
25 (min(max(f, a) ? f : 0U, 84991U))
26 -
27 (min(max(f, b) ? f : 0U, 84991U))
28 )
29 {
30 removeme();
31 }
32 }
33
34 /* removeme call should be optimized out. */
35
36 /* { dg-final { scan-tree-dump-not "removeme " "optimized" } } */