[PATCH] D19646: DivergenceAnalysis: Fix crash with unreachable blocks
    Jingyue Wu via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Apr 28 10:45:46 PDT 2016
    
    
  
jingyue added inline comments.
================
Comment at: lib/Analysis/DivergenceAnalysis.cpp:189
@@ +188,3 @@
+    DomTreeNode *InfluenceNode = DT.getNode(InfluencedBB);
+    if (!InfluenceNode)
+      break;
----------------
arsenm wrote:
> jingyue wrote:
> > 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. 
> I hit the first one, and then hit another crash here
Looking at your code more, the first check `PDT.getNode` doesn't really guard against unreachable basic blocks. You may want to use `DT.getNode()` or `DT.isReachableFromEntry` (I prefer the latter because it's more explicit) there. Then, I believe the second check here is unnecessary. 
http://reviews.llvm.org/D19646
    
    
More information about the llvm-commits
mailing list