Re: [PATCH] Don't optimize away non-pure/const calls during ccp (PR tree-optimization/51683)

2011-12-30 Thread Richard Guenther
On Wed, Dec 28, 2011 at 8:04 PM, Jakub Jelinek ja...@redhat.com wrote: Hi! For some calls (like memcpy and other builtins that are known to pass through the first argument) we know the value of the lhs, but still we shouldn't be replacing the call with just a mere assignment of that known

[PATCH] Don't optimize away non-pure/const calls during ccp (PR tree-optimization/51683)

2011-12-28 Thread Jakub Jelinek
Hi! For some calls (like memcpy and other builtins that are known to pass through the first argument) we know the value of the lhs, but still we shouldn't be replacing the call with just a mere assignment of that known value to the LHS SSA_NAME, because the call has other side-effects. Fixed

Re: [PATCH] Don't optimize away non-pure/const calls during ccp (PR tree-optimization/51683)

2011-12-28 Thread Nathan Froyd
- Original Message - else if (is_gimple_call (def_stmt)) { + int flags = gimple_call_flags (def_stmt); + + /* Don't optimize away calls that have side-effects. */ + if ((flags (ECF_CONST|ECF_PURE)) == 0 + || (flags ECF_LOOPING_CONST_OR_PURE)) This patch does this computation

Re: [PATCH] Don't optimize away non-pure/const calls during ccp (PR tree-optimization/51683)

2011-12-28 Thread Jakub Jelinek
On Wed, Dec 28, 2011 at 11:53:41AM -0800, Nathan Froyd wrote: - Original Message - else if (is_gimple_call (def_stmt)) { + int flags = gimple_call_flags (def_stmt); + + /* Don't optimize away calls that have side-effects. */ + if ((flags (ECF_CONST|ECF_PURE)) == 0 + ||