diff options
Diffstat (limited to 'llvm/test/Transforms/GlobalOpt/globalsra-multigep.ll')
-rw-r--r-- | llvm/test/Transforms/GlobalOpt/globalsra-multigep.ll | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/test/Transforms/GlobalOpt/globalsra-multigep.ll b/llvm/test/Transforms/GlobalOpt/globalsra-multigep.ll index 87a8486d881..c32a620c476 100644 --- a/llvm/test/Transforms/GlobalOpt/globalsra-multigep.ll +++ b/llvm/test/Transforms/GlobalOpt/globalsra-multigep.ll @@ -4,13 +4,20 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @g_data = internal unnamed_addr global <{ [8 x i16], [8 x i16] }> <{ [8 x i16] [i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16], [8 x i16] zeroinitializer }>, align 16 -; We cannot SRA here due to the second gep meaning the access to g_data may be to either element -; CHECK: @g_data = internal unnamed_addr constant <{ [8 x i16], [8 x i16] }> +; We normally cannot SRA here due to the second gep meaning the access to g_data may be to either element, +; unless the value is always zero. +; CHECK: @g_data.0 = internal unnamed_addr constant [8 x i16] [i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16], align 16 define i16 @test(i64 %a1) { entry: %g1 = getelementptr inbounds <{ [8 x i16], [8 x i16] }>, <{ [8 x i16], [8 x i16] }>* @g_data, i64 0, i32 0 %arrayidx.i = getelementptr inbounds [8 x i16], [8 x i16]* %g1, i64 0, i64 %a1 %r = load i16, i16* %arrayidx.i, align 2 + +; CHECK-NOT: getelementptr inbounds <{ [8 x i16], [8 x i16] }>, <{ [8 x i16], [8 x i16] }>* @g_data, i64 0, i32 0 +; CHECK: %arrayidx.i = getelementptr inbounds [8 x i16], [8 x i16]* @g_data.0, i64 0, i64 %a1 + ret i16 %r + + } |