1 /* { dg-do compile } */ 2 /* { dg-options "-O1 -fdump-tree-dom2" } */ 3 4 extern void abort (void); 5 struct rtx_def; 6 typedef struct rtx_def *rtx; 7 struct rtvec_def; 8 typedef struct rtvec_def *rtvec; 9 union tree_node; 10 typedef union tree_node *tree; 11 struct tree_common 12 { 13 int code; 14 }; 15 union tree_node 16 { 17 struct tree_common common; 18 }; 19 extern tree current_function_decl; 20 struct cgraph_rtl_info 21 { 22 _Bool pure_function; 23 }; 24 struct cgraph_rtl_info *cgraph_rtl_info (tree); 25 void mark_constant_function(void)26mark_constant_function (void) 27 { 28 rtx insn; 29 int nonlocal_memory_referenced; 30 31 if (current_function_decl->common.code != 42) 32 abort (); 33 34 cgraph_rtl_info (current_function_decl)->pure_function = 1; 35 } 36 37 /* current_function_decl should be loaded once into a temporary 38 and the temporary used as the argument to cgraph_rtl_info. 39 This if we find current_function_decl used as an argument, then 40 we have failed. */ 41 /* { dg-final { scan-tree-dump-times "\\(current_function_decl\\)" 0 "dom2"} } */ 42