[PATCH] D133369: [InstCombine] fold add+negate through select into sub
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 6 13:58:16 PDT 2022
craig.topper added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:882
+ // We need an 'add' and exactly 1 arm of the select to have been simplified.
+ if (Opcode != Instruction::Add || True == False)
+ return nullptr;
----------------
spatel wrote:
> craig.topper wrote:
> > Are we wanting to ensure that True and False are different or that only one of them is non-null?
> We want exactly one to be non-null. If they're both non-null (both arms simplified), then it'll get handled by the existing code path. If both are null (not simplifiable), then the transform won't work.
That’s not exactly what that check does though. Do we need to convert to book first before comparing?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133369/new/
https://reviews.llvm.org/D133369
More information about the llvm-commits
mailing list