[llvm] [FuncSpec] Update function specialization to handle phi-chains (PR #71442)

Momchil Velikov via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 10:19:27 PST 2023


momchil-velikov wrote:

So the algorithm works like this:
We collect a (sub-)set of all the PHI nodes, reachable from the initial PHI node along the incoming value edges.
Thus we obtain the set of all the possible values that can flow into the initial PHI node.
Then we check across all the collected PHI nodes that each incoming value is either the same constant
or a PHI node that is a member of the set.

(As a side note, that does not mean the set forms a strongly connected component in the SSA graph, it could even be acyclic).

Note that the initial PHI node should also be added to the set to account for the possibility that some of the incoming values
are the initial PHI node itself.


https://github.com/llvm/llvm-project/pull/71442


More information about the llvm-commits mailing list