[PATCH] D45448: [CVP] simplify phi with constant incoming values that match common variable edge values

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 9 11:52:38 PDT 2018


efriedma added a comment.

Any idea how often this triggers in practice?



================
Comment at: lib/Transforms/Scalar/CorrelatedValuePropagation.cpp:155
+
+  if (!CommonValue || IncomingConstants.empty())
+    return false;
----------------
This could potentially be improved to handle the !CommonValue case, I think, but I guess it might be tricky to find the appropriate value.


================
Comment at: lib/Transforms/Scalar/CorrelatedValuePropagation.cpp:165
+    BasicBlock *IncomingBB = P->getIncomingBlock(IncomingConstant.second);
+    if (auto *CommonInst = dyn_cast<Instruction>(CommonValue))
+      if (!SQ.DT->dominates(CommonInst, IncomingBB))
----------------
I don't think you have to check this separately for each incoming block; it should be enough that CommonInst dominates the block which contains the PHI node.


https://reviews.llvm.org/D45448





More information about the llvm-commits mailing list