This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CSE not combining equivalent expressions.


> 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 one, so that (2) is a no-op.  Note that the similar
	a &= ~1;
	a &= ~1;

we do catch in combine.

It could also be caught by converting

	a = ((a | 1) | 1);

into

	a = (a | (1 | 1));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]