[PATCH] D25631: [LV] Avoid emitting trivially dead instructions

Gil Rapaport via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 17 06:56:13 PDT 2016


gilr added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:4241
+  // induction variables map. An original update instruction will be dead if it
+  // has no non-dead users other than the induction variable.
+  for (auto &Induction : *Legal->getInductionVars()) {
----------------
Perhaps replace the double-negation with "... if all its users except the induction variable are dead"?


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:4246
+    if (all_of(IndUpdate->users(),
+               [&](User *U) -> bool { return U == Ind || U == Cmp; }))
+      DeadInstructions.insert(IndUpdate);
----------------
The "|| U == Cmp" test seems to kill the update whether or not Cmp is dead. Per the above comment I think you meant here "|| DeadInstructions.count(U)", right?


https://reviews.llvm.org/D25631





More information about the llvm-commits mailing list