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

Eric Gullufsen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 07:32:24 PDT 2023


emgullufsen added inline comments.
Herald added a subscriber: StephenFan.


================
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));
+}
----------------
spatel wrote:
> 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?
Sorry to leave this unseen for so long - certainly I am happy to create tests/patch to account for nsw/nuw flags, thanks @bcl5980 & @spatel


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