re PR tree-optimization/33593 (tree-outof-ssa moves sources of non-call exceptions...
[gcc.git] / gcc / testsuite / g++.dg / tree-ssa / pr21463.C
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-phiopt1" } */
3
4 template<class T> static inline const T &ref_max(const T &a, const T &b)
5 { return a<b ? b : a; }
6 template<class T> static inline const T &ref_min(const T &a, const T &b)
7 { return a<b ? a : b; }
8
9 template<class T> struct foo_t {
10 T a0, a1;
11 T bar_ref(const T b, const T c) {
12 return ref_max(ref_min(a0, c), ref_min(ref_max(a1, c), b));
13 }
14 };
15
16 template struct foo_t<int>;
17
18 /* { dg-final { scan-tree-dump-times "MIN_EXPR" 2 "phiopt1" } } */
19 /* { dg-final { scan-tree-dump-times "MAX_EXPR" 2 "phiopt1" } } */
20 /* { dg-final { cleanup-tree-dump "phiopt1" } } */