[PATCH] D112041: [InferAddressSpaces] Support assumed addrspaces from addrspace predicates.

Michael Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 18 17:39:28 PDT 2021


hliao created this revision.
hliao added reviewers: tra, yaxunl, arsenm, rampitec.
Herald added subscribers: jeroen.dobbelaere, ormris, foad, wenlei, bmahjour, kerbowa, asbirlea, rogfer01, steven_wu, george.burgess.iv, zzheng, hiraditya, nhaehnle, jvesely, jholewinski.
hliao requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, vkmr, wdng.
Herald added projects: clang, LLVM.

- CUDA cannot associate memory space with pointer types. Even though Clang could add extra attributes to specify the address space explicitly on a pointer type, it breaks the portability between Clang and NVCC.
- This change proposes to assume the address space from a pointer from the assumption built upon target-specific address space predicates, such as `__isGlobal` from CUDA. E.g.,

  foo(float *p) { __builtin_assume(__isGlobal(p)); // From there, we could assume p is a global pointer instead of a // generic one. }

  This makes the code portable without introducing the implementation-specific features.

  Note that NVCC starts to support __builtin_assume from version 11.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112041

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  llvm/include/llvm/Analysis/AssumptionCache.h
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/include/llvm/CodeGen/BasicTTIImpl.h
  llvm/include/llvm/Target/TargetMachine.h
  llvm/lib/Analysis/AssumptionCache.cpp
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h
  llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
  llvm/lib/Target/NVPTX/NVPTXTargetMachine.h
  llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
  llvm/test/Other/loop-pm-invalidation.ll
  llvm/test/Other/new-pass-manager.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Transforms/InferAddressSpaces/AMDGPU/builtin-assumed-addrspace.ll
  llvm/test/Transforms/InferAddressSpaces/NVPTX/builtin-assumed-addrspace.ll
  llvm/test/Transforms/LoopRotate/pr35210.ll
  llvm/unittests/Analysis/AliasAnalysisTest.cpp
  llvm/unittests/Analysis/AssumeBundleQueriesTest.cpp
  llvm/unittests/Analysis/BasicAliasAnalysisTest.cpp
  llvm/unittests/Analysis/DDGTest.cpp
  llvm/unittests/Analysis/IVDescriptorsTest.cpp
  llvm/unittests/Analysis/LoopInfoTest.cpp
  llvm/unittests/Analysis/LoopNestTest.cpp
  llvm/unittests/Analysis/MemorySSATest.cpp
  llvm/unittests/Analysis/ScalarEvolutionTest.cpp
  llvm/unittests/Analysis/ValueTrackingTest.cpp
  llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp
  llvm/unittests/Transforms/Utils/CodeExtractorTest.cpp
  llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp
  llvm/unittests/Transforms/Utils/LoopRotationUtilsTest.cpp
  llvm/unittests/Transforms/Utils/LoopUtilsTest.cpp
  llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp
  llvm/unittests/Transforms/Utils/UnrollLoopTest.cpp
  llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp
  llvm/unittests/Transforms/Vectorize/VPlanTestBase.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112041.380552.patch
Type: text/x-patch
Size: 64007 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211019/0f89d7a3/attachment.bin>


More information about the llvm-commits mailing list