On Mon, Nov 15, 2010 at 07:58:48PM +0100, Jakub Jelinek wrote: > Now, not sure why this happens, as there is > case GIMPLE_ASM: > for (i = 0; i < gimple_asm_nclobbers (stmt); i++) > { > tree op = gimple_asm_clobber_op (stmt, i); > if (simple_cst_equal(TREE_VALUE (op), memory_identifier_string) == > 1) > { > if (dump_file) > fprintf (dump_file, " memory asm clobber is not > const/pure"); > /* Abandon all hope, ye who enter here. */ > local->pure_const_state = IPA_NEITHER; > } > } > Debugging...
Ah, the problem is that memory_identifier_string is only initialized in ipa-reference.c's initialization, so it can be (and is in this case) NULL in ipa-pure-const.c. Two possible fixes (the latter is apparently what is used in tree-ssa-operands.c, so is probably sufficient). Guess ipa-reference.c should be changed to do the same and just drop memory_identifier_string. Jakub
--- gcc/ipa-pure-const.c.jj 2010-08-11 16:06:19.000000000 +0200 +++ gcc/ipa-pure-const.c 2010-11-15 20:06:36.121310614 +0100 @@ -460,7 +460,10 @@ check_stmt (gimple_stmt_iterator *gsip, for (i = 0; i < gimple_asm_nclobbers (stmt); i++) { tree op = gimple_asm_clobber_op (stmt, i); - if (simple_cst_equal(TREE_VALUE (op), memory_identifier_string) == 1) + if (TREE_CODE (TREE_VALUE (op)) == STRING_CST + && TREE_STRING_LENGTH (TREE_VALUE (op)) == sizeof ("memory") + && memcmp (TREE_STRING_POINTER (TREE_VALUE (op)), "memory", + sizeof ("memory")) == 0) { if (dump_file) fprintf (dump_file, " memory asm clobber is not const/pure");
--- gcc/ipa-pure-const.c.jj 2010-08-11 16:06:19.000000000 +0200 +++ gcc/ipa-pure-const.c 2010-11-15 20:07:51.463716989 +0100 @@ -460,7 +460,7 @@ check_stmt (gimple_stmt_iterator *gsip, for (i = 0; i < gimple_asm_nclobbers (stmt); i++) { tree op = gimple_asm_clobber_op (stmt, i); - if (simple_cst_equal(TREE_VALUE (op), memory_identifier_string) == 1) + if (strcmp (TREE_STRING_POINTER (TREE_VALUE (link)), "memory") == 0) { if (dump_file) fprintf (dump_file, " memory asm clobber is not const/pure");