[PATCH] D19646: DivergenceAnalysis: Fix crash with unreachable blocks

Jingyue Wu via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 10:14:03 PDT 2016


jingyue requested changes to this revision.
jingyue added a comment.
This revision now requires changes to proceed.

Thanks! I completely missed this case :(


================
Comment at: lib/Analysis/DivergenceAnalysis.cpp:143
@@ +142,3 @@
+  // Unreachable blocks may not be in the dominator tree.
+  DomTreeNode *BBNode = PDT.getNode(ThisBB);
+  if (!BBNode)
----------------
s/BBNode/ThisNode/

There are InfluenceBB and InfluenceNode below, so we'd better be explicit. 

================
Comment at: lib/Analysis/DivergenceAnalysis.cpp:189
@@ +188,3 @@
+    DomTreeNode *InfluenceNode = DT.getNode(InfluencedBB);
+    if (!InfluenceNode)
+      break;
----------------
This seems unnecessary. ThisBB is guaranteed reachable according to the check you added above. InfluenceBB is guaranteed to dominate ThisBB, so it must be reachable too. 

If you agree, maybe change this if to an assert. 


http://reviews.llvm.org/D19646





More information about the llvm-commits mailing list