[PATCH] D16836: [CodeGenPrepare] Don't transform select instructions into branches when both of operands are cheap

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 20:19:35 PST 2016


hfinkel added a subscriber: hfinkel.

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4479
@@ +4478,3 @@
+  // If both operand of the select is expected to fold away in lowering,
+  // the mispredicted branch might be more painful.
+  auto *TI = dyn_cast<Instruction>(SI->getTrueValue());
----------------
I don't understand what's going on here. So what if they fold away? They could be bitcasts, or free extensions/truncations, etc. Wouldn't you need to recurse up the use/def chain to find the non-free operand and making some determination based on that?


http://reviews.llvm.org/D16836





More information about the llvm-commits mailing list