On 11/23/2021 11:34 AM, Navid Rahimi via Gcc-patches wrote:
Hi GCC community,

I wanted you take a quick look at this patch to solve this bug [1]. This is the 
code example for the optimization [2] which does include a link to proof of 
each different optimization.

I think it should be possible to use simpler approach than what Andrew has used 
here [3].

P.S. Tested and verified on Linux x86_64.

1) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101808
2) https://compiler-explorer.com/z/Gc448eE3z
3) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101808#c1
Don't those match.pd patterns make things worse?  We're taking a single expression evaluation (the conditional) and turning it into two logicals AFAICT.

For the !x expression, obviously if x is a  constant, then we can compute that at compile time and we're going from a single conditional to a single logical which is probably a win, but that's not the case with this patch AFAICT.

jeff

Reply via email to