[PATCH] D102511: Do actual DCE in LoopUnroll

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 14 10:04:13 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/LoopUnroll.cpp:226
   const DataLayout &DL = L->getHeader()->getModule()->getDataLayout();
+  SmallVector<WeakTrackingVH, 16> DeadInsts;
   for (BasicBlock *BB : L->getBlocks()) {
----------------
Why do we need WeakTrackingVH here?


================
Comment at: llvm/lib/Transforms/Utils/LoopUnroll.cpp:239
 
-  // TODO: after peeling or unrolling, previously loop variant conditions are
-  // likely to fold to constants, eagerly propagating those here will require
-  // fewer cleanup passes to be run.  Alternatively, a LoopEarlyCSE might be
-  // appropriate.
+  while (!DeadInsts.empty()) {
+    Value *V = DeadInsts.pop_back_val();
----------------
Why not use the `RecursivelyDeleteTriviallyDeadInstructions(DeadInsts)` overload here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102511/new/

https://reviews.llvm.org/D102511



More information about the llvm-commits mailing list