1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-optimized" } */
3 
4 extern void link_error (void);
5 
6 /*
7   test that a condition  is propagated  inside an if
8 */
9 
test5(int x)10 void test5 (int x)
11 {
12   extern int foo (int);
13   if (x == 0)
14     foo (x);
15   else if (x == 0 )
16     link_error ();
17 }
18 
test55(int x,int y)19 void test55 (int x, int y)
20 {
21   int u;
22   if (x == 5 && y)
23     {
24       u = x + 22;
25       if (u != 27)
26         link_error ();
27     }
28 }
29 
30 /* There should be not link_error calls, if there is any the
31    optimization has failed */
32 /* ??? Ug.  This one may or may not fail based on how fold decides
33    that the && should be emitted (based on BRANCH_COST).  Fix this
34    by teaching dom to look through && and register all components
35    as true.  */
36 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail { ! "alpha*-*-* arm*-*-* aarch64*-*-* powerpc*-*-* cris-*-* crisv32-*-* hppa*-*-* i?86-*-* mmix-*-* mips*-*-* m68k*-*-* moxie-*-* nds32*-*-* s390*-*-* sh*-*-* sparc*-*-* spu-*-* visium-*-* x86_64-*-* riscv*-*-*" } } } } */
37