[PATCH] D95142: [SLC] Simplify strcpy and friends with non-zero address spaces

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 21 08:17:14 PST 2021


jrtc27 added inline comments.


================
Comment at: llvm/lib/Analysis/TargetLibraryInfo.cpp:647-649
+      if (DL &&
+          PTy->getPointerAddressSpace() != DL->getDefaultGlobalsAddressSpace())
+        return false;
----------------
arsenm wrote:
> This wouldn't really be right for AMDGPU, but we have no library calls anyway. I also think it's not right to use GlobalsAddressSpace for this purpose. This has nothing to do with globals or creating new values
The issue is there's no notion of "the address space that libfuncs use". The additional granularity for globals vs stack (vs others too maybe?) is unhelpful here; for us they'll all be the same (AS 200), but there is no sensible mapping from C language `void *` (or, in this case, `char *`) to the AS in use.


================
Comment at: llvm/lib/Analysis/TargetLibraryInfo.cpp:650
+        return false;
+      return PTy->getPointerElementType()->isIntegerTy(8);
+    }
----------------
arsenm wrote:
> Should never depend on pointee element type
But then it's not a char pointer?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95142



More information about the llvm-commits mailing list