Example: int f(int a, int b) { return (a|9)&9; } int f1(int a, int b) { return (a|9)&9; } This is folded at the rtl level but not at the tree level.
Oh, this was from LLVM again.
Confirmed.
Subject: Bug 23670 Author: sayle Date: Tue Feb 14 21:08:52 2006 New Revision: 110997 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110997 Log: PR middle-end/23670 * fold-const.c (fold_binary) <BIT_IOR_EXPR>: Optimize (X&Y)|Y into (X,Y) and the corresponding symmetry related transformations. (fold_binary) <BIT_AND_EXPR>: Likewise, optimize (X|Y)&Y into (X,Y) and its symmetry related transformations. * gcc.dg/tree-ssa/andor-2.c: New test case. Added: trunk/gcc/testsuite/gcc.dg/tree-ssa/andor-2.c Modified: trunk/gcc/ChangeLog trunk/gcc/fold-const.c trunk/gcc/testsuite/ChangeLog
Fixed, thanks Roger for fixing this one.