llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Failure to optimize xor pattern to xor

Open GabrielRavier opened this issue 6 years ago • 4 comments

Bugzilla Link 46475
Version trunk
OS Linux
CC @LebedevRI,@RKSimon,@nikic,@rotateright

Extended Description

bool f(bool a, bool b)
{
    return ((a & b) ^ b) | ((a & b) ^ a);
}

This can be optimized to return a ^ b;. This transformation is done by GCC, but not by LLVM.

GabrielRavier avatar Jun 27 '20 02:06 GabrielRavier

Alive2: https://alive2.llvm.org/ce/z/i44xmq I'd like to work on this

marcauberer avatar Aug 31 '23 21:08 marcauberer

Differential revision: https://reviews.llvm.org/D159380

marcauberer avatar Sep 02 '23 09:09 marcauberer

The patch has landed, so I guess we can close this now.

marcauberer avatar Sep 08 '23 08:09 marcauberer

The patch has landed, so I guess we can close this now.

For future reference, you should put something like Fixes https://github.com/llvm/llvm-project/issues/<issue num> in your commit message so that github does this for you :slightly_smiling_face:

dc03 avatar Sep 08 '23 09:09 dc03