[PATCH] D131142: [InstCombine] Canonicalize "and, add", "or, add", "xor, add"

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 04:48:40 PDT 2022


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1810
+  Value *NewBinOp = Builder.CreateBinOp(OpC, X, ConstantInt::get(Ty, *C));
+  return BinaryOperator::CreateAdd(NewBinOp, ConstantInt::get(Ty, *C2));
+}
----------------
bcl5980 wrote:
> I still insist we should add the nsw/nuw flags here as this transform is really easy case to pass the flags.
Yes - if we can keep flags, we should do that. @emgullufsen - can you create tests/patch for that?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131142/new/

https://reviews.llvm.org/D131142



More information about the llvm-commits mailing list