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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 06:44:29 PST 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:60
+      if (PHI->getType()->getPointerAddressSpace() == 0 &&
+          TheCopy->getSourceAddressSpace())
+        return false;
----------------
Why do we care about default address space here? I think what you probably want to check is `PHI->getType()->getPointerAddressSpace() != TheCopy->getPointerAddressSpace()`? But also, this code assumes that `TheCopy` is available before the PHI is seen, and I don't think anything guarantees that -- order of uses is unpredictable. I think you'd want to perform the bailout in `PointerReplacer::collectUsers()` instead? Maybe I'm misunderstanding the purpose here.


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