[PATCH] D91121: [InferAddrSpace] Teach to handle assumed address space.

Michael Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 12:20:51 PST 2020


hliao added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp:563-571
+  if (auto AS = TTI->getAssumedAddrSpace(I)) {
+    // For the assumed address space, insert an `addrspacecast` to make that
+    // explicit.
+    auto *NewPtrTy =
+        I->getType()->getPointerElementType()->getPointerTo(AS.getValue());
+    auto *NewI = new AddrSpaceCastInst(I, NewPtrTy);
+    NewI->insertAfter(I);
----------------
arsenm wrote:
> Won't this cast be naturally inserted with the inferred addres space?
We need to insert it explicitly as it's previously used as a generic pointer. Without this, we cannot change users of that generic pointer to a global one.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91121



More information about the llvm-commits mailing list