[llvm] [FuncSpec] Update function specialization to handle phi-chains (PR #72903)
Chuanqi Xu via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 21 01:31:09 PST 2023
================
@@ -262,29 +269,113 @@ Cost InstCostVisitor::estimateBranchInst(BranchInst &I) {
return estimateBasicBlocks(WorkList);
}
+bool InstCostVisitor::discoverTransitivelyIncomingValues(
+ Constant *Const, PHINode *Root, DenseSet<PHINode *> &TransitivePHIs,
+ SmallVectorImpl<PHINode *> &UnknownIncomingValues) {
+
+ SmallVector<PHINode *, 64> WorkList;
+ WorkList.push_back(Root);
+ unsigned Iter = 0;
+
+ while (!WorkList.empty()) {
+ PHINode *PN = WorkList.pop_back_val();
+
+ if (++Iter > MaxDiscoveryIterations ||
+ PN->getNumIncomingValues() > MaxIncomingPhiValues) {
+ // For now just collect the Phi and later we will check whether it is
+ // in the Transitive set.
+ UnknownIncomingValues.push_back(PN);
+ continue;
+ // FIXME: return false here and remove the UnknownIncomingValues entirely.
----------------
ChuanqiXu9 wrote:
Let's implement FIXME actually. It might not be hard.
https://github.com/llvm/llvm-project/pull/72903
More information about the llvm-commits
mailing list