[all-commits] [llvm/llvm-project] 72fc08: [InstCombine] Teach alloca replacement to handle `...

darkbuck via All-commits all-commits at lists.llvm.org
Tue Apr 11 08:55:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 72fc08a5412ec7ee7f0b904926db16cd86c1f876
      https://github.com/llvm/llvm-project/commit/72fc08a5412ec7ee7f0b904926db16cd86c1f876
  Author: Michael Liao <michael.hliao at gmail.com>
  Date:   2023-04-11 (Tue, 11 Apr 2023)

  Changed paths:
    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/Transforms/InstCombine/InstCombiner.h
    M llvm/lib/Analysis/TargetTransformInfo.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
    M llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/AMDGPU/memcpy-from-constant.ll
    M llvm/test/Transforms/InstCombine/ptr-replace-alloca.ll

  Log Message:
  -----------
  [InstCombine] Teach alloca replacement to handle `addrspacecast`

- As the address space cast may not be valid on a specific target,
  `addrspacecast` is not handled when an `alloca` is able to be replaced
  with the source of memcpy/memmove. This patch addresses that by
  querying a target hook on whether that address space cast is valid.
  For example, on most GPU targets, the cast from a global pointer to a
  generic pointer is valid.
- If that cast is allowedd (by querying `isValidAddrSpaceCast`), the
  replacement is enhanced to handle that `addrspacecast` as well.

Reviewed By: yaxunl

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




More information about the All-commits mailing list