diff options
| author | Yaxun Liu <Yaxun.Liu@amd.com> | 2018-05-19 02:58:16 +0000 |
|---|---|---|
| committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2018-05-19 02:58:16 +0000 |
| commit | ea988f1fd998d59f96a14bfb47db5470747f00d0 (patch) | |
| tree | 47579cd16422155fae679308307f107bf1e0735b /llvm/test/Transforms/GlobalOpt | |
| parent | 429e06e76bf8239b1f455f2516a3cb165e70840a (diff) | |
| download | bcm5719-llvm-ea988f1fd998d59f96a14bfb47db5470747f00d0.tar.gz bcm5719-llvm-ea988f1fd998d59f96a14bfb47db5470747f00d0.zip | |
Fix evaluator for non-zero alloca addr space
The evaluator goes through BB and creates global vars as temporary values to evaluate
results of LLVM instructions. It creates undef for alloca, however it assumes alloca
in addr space 0. If the next instruction is addrspace cast to 0, then we get an invalid
cast instruction.
This patch let the temp global var have an address space matching alloca addr space,
so that the valuation can be done.
Differential Revision: https://reviews.llvm.org/D47081
llvm-svn: 332794
Diffstat (limited to 'llvm/test/Transforms/GlobalOpt')
| -rw-r--r-- | llvm/test/Transforms/GlobalOpt/amdgcn-ctor-alloca.ll | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/Transforms/GlobalOpt/amdgcn-ctor-alloca.ll b/llvm/test/Transforms/GlobalOpt/amdgcn-ctor-alloca.ll new file mode 100644 index 00000000000..6bdcf49e95e --- /dev/null +++ b/llvm/test/Transforms/GlobalOpt/amdgcn-ctor-alloca.ll @@ -0,0 +1,17 @@ +; RUN: opt -data-layout=A5 -globalopt %s -S -o - | FileCheck %s + +; CHECK-NOT: @g +@g = internal addrspace(1) global i32* zeroinitializer + +; CHECK: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer +@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] + [{ i32, void ()*, i8* } { i32 65535, void ()* @ctor, i8* null }] + +; CHECK-NOT: @ctor +define internal void @ctor() { + %addr = alloca i32, align 8, addrspace(5) + %tmp = addrspacecast i32 addrspace(5)* %addr to i32* + store i32* %tmp, i32* addrspace(1)* @g + ret void +} + |

