[PATCH] D43743: StructurizeCFG: Test for branch divergence correctly

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 25 08:31:24 PST 2018


dberlin added inline comments.


================
Comment at: lib/Transforms/Scalar/StructurizeCFG.cpp:895
                                    const DivergenceAnalysis &DA) {
-  for (const BasicBlock *BB : R->blocks()) {
-    const BranchInst *Br = dyn_cast<BranchInst>(BB->getTerminator());
-    if (!Br || !Br->isConditional())
-      continue;
+  for (RegionNode *E : R->elements()) {
+    if (!E->isSubRegion()) {
----------------
auto please


================
Comment at: lib/Transforms/Scalar/StructurizeCFG.cpp:897
+    if (!E->isSubRegion()) {
+      const BranchInst *Br =
+          dyn_cast<BranchInst>(E->getEntry()->getTerminator());
----------------
auto


================
Comment at: lib/Transforms/Scalar/StructurizeCFG.cpp:916
+      // look at SIAnnotateControlFlow to make sure nothing breaks there.
+      for (BasicBlock *BB : E->getNodeAs<Region>()->blocks()) {
+        const BranchInst *Br = dyn_cast<BranchInst>(BB->getTerminator());
----------------
Auto here too


================
Comment at: lib/Transforms/Scalar/StructurizeCFG.cpp:934
 
+  DA = nullptr;
+
----------------
Why is this being set to null here?


Repository:
  rL LLVM

https://reviews.llvm.org/D43743





More information about the llvm-commits mailing list