1/* { dg-do compile } */
2/* { dg-options "-fdump-tree-phiopt-details -ffat-lto-objects isa>=4" } */
3/* { dg-skip-if "code quality test" { *-*-* } { "-O0" "-O1" } { "" } } */
4
5typedef struct s {
6  int v;
7  int b;
8  struct s *l;
9  struct s *r;
10} S;
11
12/* Test requires conditional moves.  */
13NOMIPS16 int foo(S *s)
14{
15  S *this;
16  S *next;
17
18  this = s;
19  if (this->b)
20    next = this->l;
21  else
22    next = this->r;
23
24  return next->v;
25}
26
27/* { dg-final { scan-tree-dump "Hoisting adjacent loads" "phiopt1" } } */
28/* { dg-final { cleanup-tree-dump "phiopt1" } } */
29