mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-25 14:32:53 +00:00
dcd188d33f
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47110 91177308-0d34-0410-b5e6-96231b3b80d8
26 lines
941 B
LLVM
26 lines
941 B
LLVM
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | \
|
|
; RUN: llvm-dis | not grep sub
|
|
|
|
%S = type { i32, i8 }
|
|
|
|
define i8 @test(i8** %P) {
|
|
%A = load i8** %P ; <i8*> [#uses=1]
|
|
%B = load i8* %A ; <i8> [#uses=1]
|
|
%X = load i8** %P ; <i8*> [#uses=1]
|
|
%Y = load i8* %X ; <i8> [#uses=1]
|
|
%R = sub i8 %B, %Y ; <i8> [#uses=1]
|
|
ret i8 %R
|
|
}
|
|
|
|
define i8 @test1(%S** %P) {
|
|
%A = load %S** %P ; <%S*> [#uses=1]
|
|
%B = getelementptr %S* %A, i32 0, i32 1 ; <i8*> [#uses=1]
|
|
%C = load i8* %B ; <i8> [#uses=1]
|
|
%X = load %S** %P ; <%S*> [#uses=1]
|
|
%Y = getelementptr %S* %X, i32 0, i32 1 ; <i8*> [#uses=1]
|
|
%Z = load i8* %Y ; <i8> [#uses=1]
|
|
%R = sub i8 %C, %Z ; <i8> [#uses=1]
|
|
ret i8 %R
|
|
}
|
|
|