[PATCH] D35777: [LoopInterchange] Update code to use range-based for loops (NFC).

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 23 11:13:13 PDT 2017


aemerson added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopInterchange.cpp:88
         return false;
-      if (LoadInst *Ld = dyn_cast<LoadInst>(I)) {
+      if (LoadInst *Ld = dyn_cast<LoadInst>(&I)) {
         if (!Ld->isSimple())
----------------
Use auto* while we're changing this anyway?


================
Comment at: lib/Transforms/Scalar/LoopInterchange.cpp:748
   if (BranchInst *BI = dyn_cast<BranchInst>(LatchBlock->getTerminator())) {
-    unsigned Num = BI->getNumSuccessors();
-    assert(Num == 2);
-    for (unsigned i = 0; i < Num; ++i) {
-      if (BI->getSuccessor(i) == LoopHeader)
+    assert(BI->getNumSuccessors() == 2);
+    for (BasicBlock *Succ : BI->successors()) {
----------------
While you're here could you add an assert string to this?


https://reviews.llvm.org/D35777





More information about the llvm-commits mailing list