[llvm] [DomTree] Fix root attachment in runDFS() (PR #73148)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 24 09:54:40 PST 2023


================
@@ -552,7 +553,7 @@ struct SemiNCAInfo {
 
     addVirtualRoot();
     unsigned Num = 1;
-    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 0);
+    for (const NodePtr Root : DT.Roots) Num = runDFS(Root, Num, DC, 1);
----------------
nikic wrote:

I don't think that would be correct. Note that this code updates `Num` on each iteration. For the first root, both will be the same, but for the later one the attachment needs to stay at 1 while the last num increases.

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


More information about the llvm-commits mailing list