OSDN Git Service

[InferAddressSpaces] Enhance the handling of cosntexpr.
authorMichael Liao <michael.hliao@gmail.com>
Fri, 10 May 2019 14:57:42 +0000 (14:57 +0000)
committerMichael Liao <michael.hliao@gmail.com>
Fri, 10 May 2019 14:57:42 +0000 (14:57 +0000)
commitdbb747a8e2bf04b6aeabfb2bc27cca0778a18e9a
tree8bf87e95047970fb393856e28d5c0be1cb38963e
parent5238a36901c0338172e69b98511f4e19671373b4
[InferAddressSpaces] Enhance the handling of cosntexpr.

Summary:
- Constant expressions may not be added in strict postorder as the
  forward instruction scan order. Thus, for a constant express (CE0), if
  its operand (CE1) is used in an previous instruction, they are not in
  postorder. However, different from
  `cloneInstructionWithNewAddressSpace`,
  `cloneConstantExprWithNewAddressSpace` doesn't bookkeep uninferred
  instructions for later resolving. That results in failure of inferring
  constant address.
- This patch adds the support to infer constant expression operand
  recursively, since there won't be loop, if that operand is another
  constant expression.

Reviewers: arsenm

Subscribers: jholewinski, jvesely, wdng, nhaehnle, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360431 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/InferAddressSpaces.cpp
test/Transforms/InferAddressSpaces/AMDGPU/infer-getelementptr.ll
test/Transforms/InferAddressSpaces/NVPTX/clone_constexpr.ll