1 /* { dg-do compile } */ 2 /* { dg-options "-O1 -fdump-tree-copyprop2" } */ 3 4 extern void abort (void); 5 extern void blah (void); 6 union tree_node; 7 typedef union tree_node *tree; 8 struct tree_vec 9 { 10 int length; 11 tree a[1]; 12 }; 13 struct tree_type 14 { 15 tree binfo; 16 }; 17 union tree_node 18 { 19 struct tree_type type; 20 struct tree_vec vec; 21 }; 22 void record_component_aliases(type)23record_component_aliases (type) 24 tree type; 25 { 26 if (type->type.binfo->vec.length) 27 abort (); 28 for (; (( 29 { 30 const tree __z = type->type.binfo; 31 if (type->type.binfo->vec.length) 32 abort (); 33 type->type.binfo->vec.a[4];} 34 )->vec.length);) 35 { 36 if (4 >= type->type.binfo->vec.length) 37 abort (); 38 blah (); 39 } 40 } 41 42 /* The call to blah should have been eliminated. If the call is not 43 eliminated, then dominator optimizations failed and it'll be 44 impossible to delete other unnecessary code. */ 45 /* { dg-final { scan-tree-dump-not "blah \\(\\)" "copyprop2" } } */ 46 47 /* There should be two IF conditionals. */ 48 /* { dg-final { scan-tree-dump-times "if " 2 "copyprop2"} } */ 49 50 /* There should be a single load of type.binfo. */ 51 /* { dg-final { scan-tree-dump-times "type\\.binfo" 1 "copyprop2"} } */ 52 53 /* There should be two loads of vec.length. */ 54 /* { dg-final { scan-tree-dump-times "vec.length" 2 "copyprop2"} } */ 55 56