[PATCH] D64713: [InstCombine] X *fast (C ? 1.0 : 0.0) -> C ? X : 0.0
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 10 06:30:19 PST 2019
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.
LGTM - the title of the patch is too specific at this point; more like:
[InstCombine] hoist binop that simplifies into arms of select
?
================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:791-801
+ } else if (LHSIsSelect && LHS->hasOneUse()) {
+ // (A ? B : C) op Y -> A ? (B op Y) : (C op Y)
+ Cond = A;
+ True = SimplifyBinOp(Opcode, B, RHS, FMF, Q);
+ False = SimplifyBinOp(Opcode, C, RHS, FMF, Q);
+ } else if (RHSIsSelect && RHS->hasOneUse()) {
+ // X op (D ? E : F) -> D ? (X op E) : (X op F)
----------------
foad wrote:
> spatel wrote:
> > Is it correct that everything outside of lines 791-801 is functionally identical to before? If so, please pre-commit that part as NFC.
> Yes, done: d162e02cee74
Thanks - that makes it clear how the new transforms fit in.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64713/new/
https://reviews.llvm.org/D64713
More information about the llvm-commits
mailing list