[PATCH] D108408: [InstCombine] Transform X == 0 ? 0 : X * Y --> X * freeze(Y).
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 26 00:09:04 PDT 2021
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:753
+ Mul->copyIRFlags(cast<Instruction>(FalseVal));
+ FalseVal->replaceAllUsesWith(Mul);
+ return Mul;
----------------
nikic wrote:
> In InstCombine, replaceInstUsesWith should be used in place of replaceAllUsesWith for worklist management reasons.
Also, can you please test the case where the other user is before the select? I think as written you're inserting the mul before the select, so it may not dominate other users. You would have to adjust the insertion point.
(This might also be one of the rare cases where modifying the mul in place to freeze one operand is more elegant than creating a new one and replacing users...)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108408/new/
https://reviews.llvm.org/D108408
More information about the llvm-commits
mailing list