[PATCH] D136201: [InstCombine] Handle PHI nodes when eliminating constant memcpy

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 13 13:39:25 PST 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:308
+        auto *V = PHI->getIncomingValue(Idx);
+        if (CopySrcAddrSpace != PHIAddrSpace && V == Copy->getDest())
+          return false;
----------------
I don't think you need this check (and as such this whole loop can be dropped).


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:336
+    if (!Worklist.contains(cast<Instruction>(V)))
+      return false;
   return true;
----------------
I think this should only be done after the whole collectUsers() phase, currently you do it on each recursive call.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136201



More information about the llvm-commits mailing list