[PATCH] D110488: [InstCombine] Canonicalize ((X & -X) - 1) --> (~X & (X - 1)) (PR51784)
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 24 08:30:11 PDT 2022
RKSimon added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:1424
+ Constant *AllOnes = ConstantInt::getAllOnesValue(RHS->getType());
+ return BinaryOperator::CreateAnd(Builder.CreateXor(A, AllOnes),
+ Builder.CreateAdd(A, AllOnes));
----------------
spatel wrote:
> xbolva00 wrote:
> > Nondet output? Different evaluation order of args between compilers
> Good catch - yeah, use local variables to ensure that the xor and add are inserted in a fixed order.
yup - I've reverted and have a fix testing on wsl2 now
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110488/new/
https://reviews.llvm.org/D110488
More information about the llvm-commits
mailing list