Re: CSE not combining equivalent expressions.

2007-01-18 Thread Jeffrey Law
On Thu, 2007-01-18 at 12:44 +0530, pranav bhandarkar wrote: On 1/17/07, Mircea Namolaru [EMAIL PROTECTED] wrote: Thanks. Another question I have is that, in this case, will the following http://gcc.gnu.org/wiki/Sign_Extension_Removal help in removal of the sign / zero extension ?

Re: CSE not combining equivalent expressions.

2007-01-18 Thread Steven Bosscher
On Thursday 18 January 2007 09:31, Jeffrey Law wrote: I haven't followed this thread that closely, but it seems to me this could be done in the propagation engine. Basically we keep track of the known zero, sign bit copies and known nonzero bits for SSA names, then propagate them in the

Re: CSE not combining equivalent expressions.

2007-01-18 Thread Jeffrey Law
On Thu, 2007-01-18 at 09:41 +0100, Steven Bosscher wrote: There appear to be more bit operations in RTL, so perhaps it is a better idea to implement a known-bits propagation pass for RTL, with the new dataflow engine. If that's the case then most of the opportunities are appearing due to

Re: CSE not combining equivalent expressions.

2007-01-18 Thread Richard Kenner
Basically we keep track of the known zero, sign bit copies and known nonzero bits for SSA names, then propagate them in the obvious ways. Basically replicating a lot of what combine cse do in this area, but at the tree level. It's something I've always wanted to see implemented, but never

Re: CSE not combining equivalent expressions.

2007-01-18 Thread Pranav Bhandarkar
On 1/18/07, Richard Kenner [EMAIL PROTECTED] wrote: I'm not immediately aware of too many cases where lowering the IL is going to expose new opportunities to track and optimize nonzero/zero bits stuff. Bitfield are the big one. If you have both bitfield and logical operations, you can often

Re: CSE not combining equivalent expressions.

2007-01-18 Thread Ramana Radhakrishnan
On 1/18/07, Jeffrey Law [EMAIL PROTECTED] wrote: On Thu, 2007-01-18 at 12:44 +0530, pranav bhandarkar wrote: On 1/17/07, Mircea Namolaru [EMAIL PROTECTED] wrote: Thanks. Another question I have is that, in this case, will the following http://gcc.gnu.org/wiki/Sign_Extension_Removal

Re: CSE not combining equivalent expressions.

2007-01-17 Thread Mircea Namolaru
Thanks. Another question I have is that, in this case, will the following http://gcc.gnu.org/wiki/Sign_Extension_Removal help in removal of the sign / zero extension ? First, it seems to me that in your case: (1) a = a | 1 /* a |= 1 */ (2) a = a | 1 /* a |= 1 */ the expressions a | 1 in

Re: CSE not combining equivalent expressions.

2007-01-17 Thread Mircea Namolaru
Thanks. Another question I have is that, in this case, will the following http://gcc.gnu.org/wiki/Sign_Extension_Removal help in removal of the sign / zero extension ? First, it seems to me that in your case: (1) a = a | 1 /* a |= 1 */ (2) a = a | 1 /* a |= 1 */ the expressions a | 1 in

Re: CSE not combining equivalent expressions.

2007-01-17 Thread Richard Kenner
First, it seems to me that in your case: (1) a = a | 1 /* a |= 1 */ (2) a = a | 1 /* a |= 1 */ the expressions a | 1 in (1) and (2) are different as the a is not the same. So there is nothing to do for CSE. It's not a CSE issue, but after (1), you know that the low-order bit of a is a

Re: CSE not combining equivalent expressions.

2007-01-17 Thread Mircea Namolaru
[EMAIL PROTECTED] (Richard Kenner) wrote on 17/01/2007 18:04:20: First, it seems to me that in your case: (1) a = a | 1 /* a |= 1 */ (2) a = a | 1 /* a |= 1 */ the expressions a | 1 in (1) and (2) are different as the a is not the same. So there is nothing to do for CSE. It's

Re: CSE not combining equivalent expressions.

2007-01-17 Thread Ramana Radhakrishnan
On 1/17/07, Mircea Namolaru [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Richard Kenner) wrote on 17/01/2007 18:04:20: First, it seems to me that in your case: (1) a = a | 1 /* a |= 1 */ (2) a = a | 1 /* a |= 1 */ the expressions a | 1 in (1) and (2) are different as the a is not

Re: CSE not combining equivalent expressions.

2007-01-17 Thread pranav bhandarkar
Also this is removed for the case of integers by the CSE pass IIRC . The problem arises only for the type being a char or a short. Yes, That is true. With gcc 4.1 one of the 'or's gets eliminated for 'int'. I am putting below two sets of logs. The first just before cse_main and the second just

Re: CSE not combining equivalent expressions.

2007-01-17 Thread pranav bhandarkar
On 1/17/07, Mircea Namolaru [EMAIL PROTECTED] wrote: Thanks. Another question I have is that, in this case, will the following http://gcc.gnu.org/wiki/Sign_Extension_Removal help in removal of the sign / zero extension ? First, it seems to me that in your case: (1) a = a | 1 /* a |= 1 */

CSE not combining equivalent expressions.

2007-01-15 Thread pranav bhandarkar
Hello Everyone, I have the following source code static int i; static char a; char foo_gen(int); void foo_assert(char); void foo () { int *x = i; a = foo_gen(0); a |= 1; /* 1-*/ if (*x) goto end: a | =1; /* -2--*/ foo_assert(a); end: return; } Now I expect

Re: CSE not combining equivalent expressions.

2007-01-15 Thread Richard Guenther
On 1/15/07, pranav bhandarkar [EMAIL PROTECTED] wrote: Hello Everyone, I have the following source code static int i; static char a; char foo_gen(int); void foo_assert(char); void foo () { int *x = i; a = foo_gen(0); a |= 1; /* 1-*/ if (*x) goto end: a | =1; /*

Re: CSE not combining equivalent expressions.

2007-01-15 Thread pranav bhandarkar
On 1/15/07, Richard Guenther [EMAIL PROTECTED] wrote: On 1/15/07, pranav bhandarkar [EMAIL PROTECTED] wrote: Hello Everyone, I have the following source code static int i; static char a; char foo_gen(int); void foo_assert(char); void foo () { int *x = i; a = foo_gen(0); a