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

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 15:06:47 PST 2022


arsenm added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:52
   while (!ValuesToInspect.empty()) {
     auto ValuePair = ValuesToInspect.pop_back_val();
+    const bool IsOffset = std::get<1>(ValuePair);
----------------
Use the new C++17 tuple syntax,



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:335-336
+          NewTy->getPointerAddressSpace()) {
+        V = AddrSpaceCastInst::CreatePointerBitCastOrAddrSpaceCast(
+            V, NewTy, V->getName(), NewPHI);
+        PtrCastInserted = true;
----------------
In general InstCombine can't introduce a new address space cast when one didn't exist in the first place 


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:344
+      auto *OrigTypeCast =
+          AddrSpaceCastInst::CreatePointerBitCastOrAddrSpaceCast(
+              NewPHI, PHI->getType());
----------------
Ditto


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