[PATCH] D132450: StructurizeCFG: Set Undef for non-predecessors in setPhiValues()

Ruiling, Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 02:40:27 PDT 2022


ruiling added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/StructurizeCFG.cpp:687-689
+              // If this is not flow node and not the incoming block before
+              // structurization, then this block does not contribute any value
+              // to the phi.
----------------
ruiling wrote:
> sameerds wrote:
> > This is the core idea. But it's not obvious how the code implements this. Would be good to have an explanation of the Stack and the Incomings set. For example, why do we need to erase Current from Incomings? Somewhere in the traversal, the Stack seems to ensure that undefs are added to phis at intermediate Flow blocks ... needs explanation of why it always works.
> Sorry I don't quite get your point. The reason we need to erase Current from I
The reason I was erasing Current from Incomings is to try to terminate the traversal loop after finishing all the incoming predecessors. But now I think this maybe not quite necessary. The Stack is just used as traversal stack, no other meaning.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132450



More information about the llvm-commits mailing list