diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-11-04 20:46:52 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-11-04 20:46:52 +0000 |
commit | 896a885f215d8e3e2835b92274319771d358f313 (patch) | |
tree | 17ed263c8d60c0eec4422fe5b44b6dd46683e761 /test | |
parent | eba6d384489be4e56718186aa7ed7e484df24613 (diff) | |
download | llvm-896a885f215d8e3e2835b92274319771d358f313.tar.gz llvm-896a885f215d8e3e2835b92274319771d358f313.tar.bz2 llvm-896a885f215d8e3e2835b92274319771d358f313.tar.xz |
Fix another constant folding address space place I missed.
This fixes an assertion failure with a different sized address space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194014 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/constant-fold-gep.ll | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/Transforms/InstCombine/constant-fold-gep.ll b/test/Transforms/InstCombine/constant-fold-gep.ll index 9f82e66b38..5fb56023a4 100644 --- a/test/Transforms/InstCombine/constant-fold-gep.ll +++ b/test/Transforms/InstCombine/constant-fold-gep.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -instcombine -S | FileCheck %s -target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" +target datalayout = "E-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" ; Constant folding should fix notionally out-of-bounds indices ; and add inbounds keywords. @@ -72,3 +72,21 @@ entry: ret i64 %E ; CHECK: ret i64 1000 } + +@X_as1 = addrspace(1) global [1000 x i8] zeroinitializer, align 16 + +define i16 @test2_as1() { +; CHECK-LABEL: @test2_as1( + ; CHECK: ret i16 1000 + +entry: + %A = bitcast i8 addrspace(1)* getelementptr inbounds ([1000 x i8] addrspace(1)* @X_as1, i64 1, i64 0) to i8 addrspace(1)* + %B = bitcast i8 addrspace(1)* getelementptr inbounds ([1000 x i8] addrspace(1)* @X_as1, i64 0, i64 0) to i8 addrspace(1)* + + %B2 = ptrtoint i8 addrspace(1)* %B to i16 + %C = sub i16 0, %B2 + %D = getelementptr i8 addrspace(1)* %A, i16 %C + %E = ptrtoint i8 addrspace(1)* %D to i16 + + ret i16 %E +} |