[PATCH] Remove loop variant range check when induction variable is strictly increasing

Sanjoy Das sanjoy at playingwithpointers.com
Thu May 14 19:24:40 PDT 2015


I think this is okay to commit, but I'll wait for Andy to take a look.


================
Comment at: lib/Transforms/Utils/SimplifyIndVar.cpp:189
@@ +188,3 @@
+    auto *BI = dyn_cast<BranchInst>(U);
+    if (!BI || BI->isUnconditional())
+      continue;
----------------
Might want to just `assert(BI->isConditional())` here, since it uses an icmp.

================
Comment at: lib/Transforms/Utils/SimplifyIndVar.cpp:194
@@ +193,3 @@
+    if (DominatesBackedges(BI, L, DT))
+      return true;
+  }
----------------
Do you need to check / assert that `BI` is itself within the loop?  I think you can just assert it if `DominatesBackedges(BI, L, DT)` since `BI` uses `ICmp` which uses an induction variable.

http://reviews.llvm.org/D9784

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list