[PATCH] D86347: [SimplifyCFG] Two entry phi select costs

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 06:39:17 PDT 2020


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:98-102
 static cl::opt<unsigned> TwoEntryPHINodeFoldingThreshold(
     "two-entry-phi-node-folding-threshold", cl::Hidden, cl::init(4),
     cl::desc("Control the maximal total instruction cost that we are willing "
              "to speculatively execute to fold a 2-entry PHI node into a "
              "select (default = 4)"));
----------------
You need to bump it by that new cmp+sel cost, so `+2`.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:2000
+/// budget.
+static bool selectCostsWithinBudget(BasicBlock *BB, BasicBlock *ThenBB,
+                                    BasicBlock *EndBB, int BudgetRemaining,
----------------
Put this into D86346?


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:2011
+    if (OrigV != ThenV)
+      BudgetRemaining -=
+          TTI.getCmpSelInstrCost(Instruction::Select, PN.getType(), nullptr,
----------------
I'm not sure this does what you think it does..


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86347/new/

https://reviews.llvm.org/D86347



More information about the llvm-commits mailing list