[all-commits] [llvm/llvm-project] bf2259: [InferAddressSpaces] Support assumed addrspaces fr...

darkbuck via All-commits all-commits at lists.llvm.org
Mon Nov 8 13:52:21 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bf225939bc3acf936c962f24423d3bb5ddd4c93f
      https://github.com/llvm/llvm-project/commit/bf225939bc3acf936c962f24423d3bb5ddd4c93f
  Author: Michael Liao <michael.hliao at gmail.com>
  Date:   2021-11-08 (Mon, 08 Nov 2021)

  Changed paths:
    M clang/test/CodeGen/thinlto-distributed-newpm.ll
    M llvm/include/llvm/Analysis/AssumptionCache.h
    M llvm/include/llvm/Analysis/TargetTransformInfo.h
    M llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
    M llvm/include/llvm/CodeGen/BasicTTIImpl.h
    M llvm/include/llvm/Target/TargetMachine.h
    M llvm/lib/Analysis/AssumptionCache.cpp
    M llvm/lib/Analysis/TargetTransformInfo.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h
    M llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
    M llvm/lib/Target/NVPTX/NVPTXTargetMachine.h
    M llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
    M llvm/test/Other/loop-pm-invalidation.ll
    M llvm/test/Other/new-pass-manager.ll
    M llvm/test/Other/new-pm-lto-defaults.ll
    M llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
    A llvm/test/Transforms/InferAddressSpaces/AMDGPU/builtin-assumed-addrspace.ll
    A llvm/test/Transforms/InferAddressSpaces/NVPTX/builtin-assumed-addrspace.ll
    M llvm/test/Transforms/LoopRotate/pr35210.ll
    M llvm/unittests/Analysis/AssumeBundleQueriesTest.cpp

  Log Message:
  -----------
  [InferAddressSpaces] Support assumed addrspaces from addrspace predicates.

- 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.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D112041




More information about the All-commits mailing list