[PATCH] D64713: [InstCombine] X *fast (C ? 1.0 : 0.0) -> C ? X : 0.0

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 04:21:53 PDT 2019


xbolva00 added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:782
+      SI = Builder.CreateSelect(A, Builder.CreateBinOp(Opcode, B, E), V1);
+  } else if (LHSIsSelect) {
+    // (A ? B : C) op Y -> A ? (B op Y) : (C op Y)
----------------
foad wrote:
> xbolva00 wrote:
> > Can you simplify lines 782-808? Almost same code in both branches..
> I'd prefer to keep the SimplifyFPBinOp/CreateSelect calls in separate branches, otherwise I think the code will get much more confusing to read.
> 
> As for the boilerplate code to do with fast math flags: I could either pull it all out to the top level of the function (so it would run unconditionally, even if we're not able to optimize anything); or I could try teaching SimplifyQuery about fast math flags (as mentioned above), which would simplify it a little. Do you have any preference?
>> As for the boilerplate code to do with fast math flags:

Maybe use lambda?


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