https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87186
Richard Biener changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87186
--- Comment #6 from Marc Glisse ---
In some sense, the bug is that .original is optimized at all, ideally it would
be the "original" unoptimized code. It is convenient to start optimizing single
expressions early, so we do it, but that's it.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87186
--- Comment #5 from Andrew Pinski ---
Right, original is not the one to look at really. There are more passes later
on that will optimize it using the patterns that optimized the original one.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87186
--- Comment #4 from MCCCS ---
Flags: -O2 -fdump-tree-original
Code:
int f1 (int x, int s) {
return ~(~(x|s)|x)|~(~(x|s)|s);
}
int f2 (int x, int s) {
const int t = x|s;
return ~(~t|x)|~(~t|s);
}
int f3 (int x, int s) {
const int t = ~(x|s);
r
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87186
--- Comment #3 from Andrew Pinski ---
Can you provide a full testcase that can compile?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87186
--- Comment #2 from Marc Glisse ---
How did you check? Looking at the .optimized dump or the asm, it is optimized
to a simple xor.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87186
--- Comment #1 from MCCCS ---
It can simplify
~(~(x|s)|x)|~(~(x|s)|s)
to
s^x
but it can't simplify
const int t = x|s;
~(~t|x)|~(~t|s)
or
const int t = ~(x|s);
~(t|x)|~(t|s)
or
const int t = ~x&~s;
~(t|x)|~(t|s)