1 /* { dg-do compile } */ 2 /* { dg-options "-O -fdump-tree-dce3" } */ 3 4 struct rtx_def; 5 typedef struct rtx_def *rtx; 6 union tree_node; 7 typedef union tree_node *tree; 8 typedef struct mem_attrs 9 { 10 int foo; 11 12 } mem_attrs; 13 union rtunion_def 14 { 15 mem_attrs *rtmem; 16 }; 17 typedef union rtunion_def rtunion; 18 struct rtx_def 19 { 20 rtunion fld[1]; 21 }; 22 struct tree_decl 23 { 24 rtx rtl; 25 }; 26 union tree_node 27 { 28 struct tree_decl decl; 29 }; 30 int make_decl_rtl (tree, int); 31 void * get_alias_set(t)32get_alias_set (t) 33 tree t; 34 { 35 long set; 36 if (t->decl.rtl) 37 return (t->decl.rtl->fld[1].rtmem 38 ? 0 39 : (((t->decl.rtl ? t->decl.rtl: (make_decl_rtl (t, 0), t->decl.rtl)))->fld[1]).rtmem); 40 return (void*)-1; 41 } 42 43 /* There should be precisely one load of ->decl.rtl. If there is 44 more than, then the dominator optimizations failed. */ 45 /* { dg-final { scan-tree-dump-times "->decl\\.rtl" 1 "dce3"} } */ 46 47 /* There should be no loads of .rtmem since the complex return statement 48 is just "return 0". */ 49 /* { dg-final { scan-tree-dump-times ".rtmem" 0 "dce3"} } */ 50 51 /* There should be one IF statement (the complex return statement should 52 collapse down to a simple return 0 without any conditionals). */ 53 /* { dg-final { scan-tree-dump-times "if " 1 "dce3"} } */ 54 55