At the end ofIn formLCSSAForInstructions we remove PHI nodes thatspeculatively add new PHI
were added speculatively,nodes, that sometimes ends up without having any uses. but ended up as never being used.It
In the past we determined if a node should be removed beforehas been discovered that sometimes an added PHI node can
the whole Worklist had been processed. So we could end upappear as being unused in one iteration of the Worklist,
adding a PHI node (currently notalthough it can end up being used) to the by a PHIsToRemove node added in
lista later iteration. We now check, a second time, and then before doing the actual removal we could introducethat the
new uses of the PHI node when speculatively adding new PHI nodes.
Now we create a list of all PHI nodes that has been added whilePHI node still is unused before we remove it. This avoids
processing the Worklist, and then we iteratively remove unusedan assert about "Trying to remove a phi with uses." for the
PHI nodes at the end of formLCSSAForInstructions. This will
avoid the assertion about "Trying to remove a phi with uses" as
well as catching the situation when one added (and unused) PHI
node is using another added (but otherwise unused) PHI nodadded test case.