[Tests] Convert Feature tests to opaque pointers (NFC)

This commit is contained in:
Nikita Popov 2022-12-13 15:45:54 +01:00
parent 57f71dccd3
commit 1842a2909e
46 changed files with 351 additions and 366 deletions

View File

@ -1,33 +1,33 @@
; RUN: opt -S -aa-pipeline=basic-aa -passes=gvn < %s | FileCheck %s ; RUN: opt -S -aa-pipeline=basic-aa -passes=gvn < %s | FileCheck %s
declare void @argmemonly_function(i32 *) argmemonly declare void @argmemonly_function(ptr) argmemonly
define i32 @test0(i32* %P, i32* noalias %P2) { define i32 @test0(ptr %P, ptr noalias %P2) {
; CHECK-LABEL: @test0( ; CHECK-LABEL: @test0(
%v1 = load i32, i32* %P %v1 = load i32, ptr %P
; CHECK: %v1 = load i32, i32* %P ; CHECK: %v1 = load i32, ptr %P
call void @argmemonly_function(i32* %P2) [ "tag"() ] call void @argmemonly_function(ptr %P2) [ "tag"() ]
; CHECK: call void @argmemonly_function( ; CHECK: call void @argmemonly_function(
%v2 = load i32, i32* %P %v2 = load i32, ptr %P
; CHECK: %v2 = load i32, i32* %P ; CHECK: %v2 = load i32, ptr %P
%diff = sub i32 %v1, %v2 %diff = sub i32 %v1, %v2
; CHECK: %diff = sub i32 %v1, %v2 ; CHECK: %diff = sub i32 %v1, %v2
ret i32 %diff ret i32 %diff
; CHECK: ret i32 %diff ; CHECK: ret i32 %diff
} }
define i32 @test1(i32* %P, i32* noalias %P2) { define i32 @test1(ptr %P, ptr noalias %P2) {
; CHECK-LABEL: @test1( ; CHECK-LABEL: @test1(
%v1 = load i32, i32* %P %v1 = load i32, ptr %P
call void @argmemonly_function(i32* %P2) argmemonly [ "tag"() ] call void @argmemonly_function(ptr %P2) argmemonly [ "tag"() ]
; CHECK: call void @argmemonly_function( ; CHECK: call void @argmemonly_function(
%v2 = load i32, i32* %P %v2 = load i32, ptr %P
%diff = sub i32 %v1, %v2 %diff = sub i32 %v1, %v2
ret i32 %diff ret i32 %diff
; CHECK: ret i32 0 ; CHECK: ret i32 0
} }
define i32 @test2(i32* %P, i32* noalias %P2) { define i32 @test2(ptr %P, ptr noalias %P2) {
; Note: in this test we //can// GVN %v1 and %v2 into one value in theory. Calls ; Note: in this test we //can// GVN %v1 and %v2 into one value in theory. Calls
; with deopt operand bundles are not argmemonly because they *read* the entire ; with deopt operand bundles are not argmemonly because they *read* the entire
; heap, but they don't write to any location in the heap if the callee does not ; heap, but they don't write to any location in the heap if the callee does not
@ -36,10 +36,10 @@ define i32 @test2(i32* %P, i32* noalias %P2) {
; that %P is not written to at the callsite. ; that %P is not written to at the callsite.
; CHECK-LABEL: @test2( ; CHECK-LABEL: @test2(
%v1 = load i32, i32* %P %v1 = load i32, ptr %P
call void @argmemonly_function(i32* %P2) [ "deopt"() ] call void @argmemonly_function(ptr %P2) [ "deopt"() ]
; CHECK: call void @argmemonly_function( ; CHECK: call void @argmemonly_function(
%v2 = load i32, i32* %P %v2 = load i32, ptr %P
%diff = sub i32 %v1, %v2 %diff = sub i32 %v1, %v2
ret i32 %diff ret i32 %diff
; CHECK: ret i32 0 ; CHECK: ret i32 0

View File

@ -1,31 +1,31 @@
; RUN: opt -S -passes=dse < %s | FileCheck %s ; RUN: opt -S -passes=dse < %s | FileCheck %s
declare void @f() declare void @f()
declare noalias i8* @malloc(i32) nounwind declare noalias ptr @malloc(i32) nounwind
define void @test_0() { define void @test_0() {
; CHECK-LABEL: @test_0( ; CHECK-LABEL: @test_0(
%m = call i8* @malloc(i32 24) %m = call ptr @malloc(i32 24)
tail call void @f() [ "unknown"(i8* %m) ] tail call void @f() [ "unknown"(ptr %m) ]
; CHECK: store i8 -19, i8* %m ; CHECK: store i8 -19, ptr %m
store i8 -19, i8* %m store i8 -19, ptr %m
ret void ret void
} }
define i8* @test_1() { define ptr @test_1() {
; CHECK-LABEL: @test_1( ; CHECK-LABEL: @test_1(
%m = call i8* @malloc(i32 24) %m = call ptr @malloc(i32 24)
tail call void @f() [ "unknown"(i8* %m) ] tail call void @f() [ "unknown"(ptr %m) ]
store i8 -19, i8* %m store i8 -19, ptr %m
tail call void @f() tail call void @f()
store i8 101, i8* %m store i8 101, ptr %m
; CHECK: tail call void @f() [ "unknown"(i8* %m) ] ; CHECK: tail call void @f() [ "unknown"(ptr %m) ]
; CHECK: store i8 -19, i8* %m ; CHECK: store i8 -19, ptr %m
; CHECK: tail call void @f() ; CHECK: tail call void @f()
; CHECK: store i8 101, i8* %m ; CHECK: store i8 101, ptr %m
ret i8* %m ret ptr %m
} }
define void @test_2() { define void @test_2() {
@ -33,26 +33,26 @@ define void @test_2() {
; legal to elide the final store that location. ; legal to elide the final store that location.
; CHECK-LABEL: @test_2( ; CHECK-LABEL: @test_2(
%m = call i8* @malloc(i32 24) %m = call ptr @malloc(i32 24)
tail call void @f() [ "deopt"(i8* %m) ] tail call void @f() [ "deopt"(ptr %m) ]
store i8 -19, i8* %m store i8 -19, ptr %m
ret void ret void
; CHECK: tail call void @f() [ "deopt"(i8* %m) ] ; CHECK: tail call void @f() [ "deopt"(ptr %m) ]
; CHECK-NEXT: ret void ; CHECK-NEXT: ret void
} }
define i8* @test_3() { define ptr @test_3() {
; Since the deopt operand bundle does not escape %m (see caveat below), @f ; Since the deopt operand bundle does not escape %m (see caveat below), @f
; cannot observe the stores to %m ; cannot observe the stores to %m
; CHECK-LABEL: @test_3( ; CHECK-LABEL: @test_3(
%m = call i8* @malloc(i32 24) %m = call ptr @malloc(i32 24)
tail call void @f() [ "deopt"(i8* %m) ] tail call void @f() [ "deopt"(ptr %m) ]
store i8 -19, i8* %m store i8 -19, ptr %m
tail call void @f() tail call void @f()
store i8 101, i8* %m store i8 101, ptr %m
ret i8* %m ret ptr %m
} }

View File

@ -9,90 +9,90 @@
declare void @readonly_function() readonly nounwind willreturn declare void @readonly_function() readonly nounwind willreturn
declare void @readnone_function() readnone nounwind willreturn declare void @readnone_function() readnone nounwind willreturn
define i32 @test0(i32* %x) { define i32 @test0(ptr %x) {
; CHECK-LABEL: @test0( ; CHECK-LABEL: @test0(
; CHECK-NEXT: entry: ; CHECK-NEXT: entry:
; CHECK-NEXT: store i32 100, i32* [[X:%.*]], align 4 ; CHECK-NEXT: store i32 100, ptr [[X:%.*]], align 4
; CHECK-NEXT: call void @readonly_function() [ "tag"() ] ; CHECK-NEXT: call void @readonly_function() [ "tag"() ]
; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[X]], align 4 ; CHECK-NEXT: [[V:%.*]] = load i32, ptr [[X]], align 4
; CHECK-NEXT: ret i32 [[V]] ; CHECK-NEXT: ret i32 [[V]]
; ;
entry: entry:
store i32 100, i32* %x store i32 100, ptr %x
call void @readonly_function() [ "tag"() ] call void @readonly_function() [ "tag"() ]
%v = load i32, i32* %x %v = load i32, ptr %x
ret i32 %v ret i32 %v
} }
define i32 @test1(i32* %x) { define i32 @test1(ptr %x) {
; CHECK-LABEL: @test1( ; CHECK-LABEL: @test1(
; CHECK-NEXT: entry: ; CHECK-NEXT: entry:
; CHECK-NEXT: store i32 100, i32* [[X:%.*]], align 4 ; CHECK-NEXT: store i32 100, ptr [[X:%.*]], align 4
; CHECK-NEXT: ret i32 100 ; CHECK-NEXT: ret i32 100
; ;
entry: entry:
store i32 100, i32* %x store i32 100, ptr %x
call void @readonly_function() readonly [ "tag"() ] call void @readonly_function() readonly [ "tag"() ]
%v = load i32, i32* %x %v = load i32, ptr %x
ret i32 %v ret i32 %v
} }
define i32 @test3(i32* %x) { define i32 @test3(ptr %x) {
; CHECK-LABEL: @test3( ; CHECK-LABEL: @test3(
; CHECK-NEXT: entry: ; CHECK-NEXT: entry:
; CHECK-NEXT: store i32 100, i32* [[X:%.*]], align 4 ; CHECK-NEXT: store i32 100, ptr [[X:%.*]], align 4
; CHECK-NEXT: ret i32 100 ; CHECK-NEXT: ret i32 100
; ;
entry: entry:
store i32 100, i32* %x store i32 100, ptr %x
call void @readonly_function() call void @readonly_function()
%v = load i32, i32* %x %v = load i32, ptr %x
ret i32 %v ret i32 %v
} }
define void @test4(i32* %x) { define void @test4(ptr %x) {
; CHECK-LABEL: @test4( ; CHECK-LABEL: @test4(
; CHECK-NEXT: entry: ; CHECK-NEXT: entry:
; CHECK-NEXT: store i32 100, i32* [[X:%.*]], align 4 ; CHECK-NEXT: store i32 100, ptr [[X:%.*]], align 4
; CHECK-NEXT: call void @readnone_function() [ "tag"() ] ; CHECK-NEXT: call void @readnone_function() [ "tag"() ]
; CHECK-NEXT: store i32 200, i32* [[X]], align 4 ; CHECK-NEXT: store i32 200, ptr [[X]], align 4
; CHECK-NEXT: ret void ; CHECK-NEXT: ret void
; ;
entry: entry:
store i32 100, i32* %x store i32 100, ptr %x
call void @readnone_function() [ "tag"() ] call void @readnone_function() [ "tag"() ]
store i32 200, i32* %x store i32 200, ptr %x
ret void ret void
} }
define void @test5(i32* %x) { define void @test5(ptr %x) {
; CHECK-LABEL: @test5( ; CHECK-LABEL: @test5(
; CHECK-NEXT: entry: ; CHECK-NEXT: entry:
; CHECK-NEXT: store i32 200, i32* [[X:%.*]], align 4 ; CHECK-NEXT: store i32 200, ptr [[X:%.*]], align 4
; CHECK-NEXT: ret void ; CHECK-NEXT: ret void
; ;
entry: entry:
store i32 100, i32* %x store i32 100, ptr %x
call void @readnone_function() readnone [ "tag"() ] call void @readnone_function() readnone [ "tag"() ]
store i32 200, i32* %x store i32 200, ptr %x
ret void ret void
} }
define void @test6(i32* %x) { define void @test6(ptr %x) {
; The "deopt" operand bundle does not make the call to ; The "deopt" operand bundle does not make the call to
; @readonly_function read-write; and so the nounwind readonly call can ; @readonly_function read-write; and so the nounwind readonly call can
; be deleted. ; be deleted.
; CHECK-LABEL: @test6( ; CHECK-LABEL: @test6(
; CHECK-NEXT: entry: ; CHECK-NEXT: entry:
; CHECK-NEXT: store i32 200, i32* [[X:%.*]], align 4 ; CHECK-NEXT: store i32 200, ptr [[X:%.*]], align 4
; CHECK-NEXT: ret void ; CHECK-NEXT: ret void
; ;
entry: entry:
store i32 100, i32* %x store i32 100, ptr %x
call void @readonly_function() [ "deopt"() ] call void @readonly_function() [ "deopt"() ]
store i32 200, i32* %x store i32 200, ptr %x
ret void ret void
} }

View File

@ -4,42 +4,42 @@ declare void @f_readonly() readonly
declare void @f_readnone() readnone declare void @f_readnone() readnone
declare void @f_writeonly() writeonly declare void @f_writeonly() writeonly
define void @test_0(i32* %x) { define void @test_0(ptr %x) {
; FunctionAttrs must not infer readonly / readnone for %x ; FunctionAttrs must not infer readonly / readnone for %x
; CHECK-LABEL: define void @test_0(i32* %x) #3 { ; CHECK-LABEL: define void @test_0(ptr %x) #3 {
entry: entry:
; CHECK: call void @f_readonly() [ "foo"(i32* %x) ] ; CHECK: call void @f_readonly() [ "foo"(ptr %x) ]
call void @f_readonly() [ "foo"(i32* %x) ] call void @f_readonly() [ "foo"(ptr %x) ]
ret void ret void
} }
define void @test_1(i32* %x) { define void @test_1(ptr %x) {
; FunctionAttrs must not infer readonly / readnone for %x ; FunctionAttrs must not infer readonly / readnone for %x
; CHECK-LABEL: define void @test_1(i32* %x) #4 { ; CHECK-LABEL: define void @test_1(ptr %x) #4 {
entry: entry:
; CHECK: call void @f_readnone() [ "foo"(i32* %x) ] ; CHECK: call void @f_readnone() [ "foo"(ptr %x) ]
call void @f_readnone() [ "foo"(i32* %x) ] call void @f_readnone() [ "foo"(ptr %x) ]
ret void ret void
} }
define void @test_2(i32* %x) { define void @test_2(ptr %x) {
; FunctionAttrs must not infer writeonly ; FunctionAttrs must not infer writeonly
; CHECK-LABEL: define void @test_2(i32* %x) { ; CHECK-LABEL: define void @test_2(ptr %x) {
entry: entry:
; CHECK: call void @f_writeonly() [ "foo"(i32* %x) ] ; CHECK: call void @f_writeonly() [ "foo"(ptr %x) ]
call void @f_writeonly() [ "foo"(i32* %x) ] call void @f_writeonly() [ "foo"(ptr %x) ]
ret void ret void
} }
define void @test_3(i32* %x) { define void @test_3(ptr %x) {
; The "deopt" operand bundle does not capture or write to %x. ; The "deopt" operand bundle does not capture or write to %x.
; CHECK-LABEL: define void @test_3(i32* nocapture readonly %x) ; CHECK-LABEL: define void @test_3(ptr nocapture readonly %x)
entry: entry:
call void @f_readonly() [ "deopt"(i32* %x) ] call void @f_readonly() [ "deopt"(ptr %x) ]
ret void ret void
} }

View File

@ -10,18 +10,18 @@
declare void @foo() readnone declare void @foo() readnone
; CHECK-LABEL: define i8* @test(i8* %p) ; CHECK-LABEL: define ptr @test(ptr %p)
; CHECK: %a = alloca i8*, align 8 ; CHECK: %a = alloca ptr, align 8
; CHECK: store i8* %p, i8** %a, align 8 ; CHECK: store ptr %p, ptr %a, align 8
; CHECK: call void @foo() [ "abc"(i8** %a) ] ; CHECK: call void @foo() [ "abc"(ptr %a) ]
; CHECK: %reload = load i8*, i8** %a, align 8 ; CHECK: %reload = load ptr, ptr %a, align 8
; CHECK: ret i8* %reload ; CHECK: ret ptr %reload
; CHECK: } ; CHECK: }
define i8* @test(i8* %p) { define ptr @test(ptr %p) {
%a = alloca i8*, align 8 %a = alloca ptr, align 8
store i8* %p, i8** %a, align 8 store ptr %p, ptr %a, align 8
call void @foo() ["abc" (i8** %a)] call void @foo() ["abc" (ptr %a)]
%reload = load i8*, i8** %a, align 8 %reload = load ptr, ptr %a, align 8
ret i8* %reload ret ptr %reload
} }

View File

@ -9,20 +9,20 @@
@v3 = global [2 x i16] zeroinitializer @v3 = global [2 x i16] zeroinitializer
; CHECK: @v3 = global [2 x i16] zeroinitializer ; CHECK: @v3 = global [2 x i16] zeroinitializer
@a1 = alias i16, bitcast (i32* @v1 to i16*) @a1 = alias i16, ptr @v1
; CHECK: @a1 = alias i16, bitcast (i32* @v1 to i16*) ; CHECK: @a1 = alias i16, ptr @v1
@a2 = alias i32, bitcast([1 x i32]* @v2 to i32*) @a2 = alias i32, ptr @v2
; CHECK: @a2 = alias i32, getelementptr inbounds ([1 x i32], [1 x i32]* @v2, i32 0, i32 0) ; CHECK: @a2 = alias i32, ptr @v2
@a3 = alias i32, addrspacecast (i32* @v1 to i32 addrspace(2)*) @a3 = alias i32, addrspacecast (ptr @v1 to ptr addrspace(2))
; CHECK: @a3 = alias i32, addrspacecast (i32* @v1 to i32 addrspace(2)*) ; CHECK: @a3 = alias i32, addrspacecast (ptr @v1 to ptr addrspace(2))
@a4 = alias i16, bitcast (i32* @v1 to i16*) @a4 = alias i16, ptr @v1
; CHECK: @a4 = alias i16, bitcast (i32* @v1 to i16*) ; CHECK: @a4 = alias i16, ptr @v1
@a5 = thread_local(localdynamic) alias i32, i32* @v1 @a5 = thread_local(localdynamic) alias i32, ptr @v1
; CHECK: @a5 = thread_local(localdynamic) alias i32, i32* @v1 ; CHECK: @a5 = thread_local(localdynamic) alias i32, ptr @v1
@a6 = alias i16, getelementptr ([2 x i16], [2 x i16]* @v3, i32 1, i32 1) @a6 = alias i16, getelementptr ([2 x i16], ptr @v3, i32 1, i32 1)
; CHECK: @a6 = alias i16, getelementptr ([2 x i16], [2 x i16]* @v3, i32 1, i32 1) ; CHECK: @a6 = alias i16, getelementptr ([2 x i16], ptr @v3, i32 1, i32 1)

View File

@ -2,13 +2,13 @@
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll ; RUN: diff %t1.ll %t2.ll
@X = global i32 4, align 16 ; <i32*> [#uses=0] @X = global i32 4, align 16 ; <ptr> [#uses=0]
define i32* @test() align 32 { define ptr @test() align 32 {
%X = alloca i32, align 4 ; <i32*> [#uses=1] %X = alloca i32, align 4 ; <ptr> [#uses=1]
%Y = alloca i32, i32 42, align 16 ; <i32*> [#uses=0] %Y = alloca i32, i32 42, align 16 ; <ptr> [#uses=0]
%Z = alloca i32 ; <i32*> [#uses=0] %Z = alloca i32 ; <ptr> [#uses=0]
ret i32* %X ret ptr %X
} }
define void @test3() alignstack(16) { define void @test3() alignstack(16) {
ret void ret void

View File

@ -6,10 +6,10 @@
define void @foo() #0 { define void @foo() #0 {
entry: entry:
%call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i32 0, i32 0)) %call = call i32 (ptr, ...) @printf(ptr @.str)
ret void ret void
} }
declare i32 @printf(i8*, ...) declare i32 @printf(ptr, ...)
attributes #0 = { nounwind ssp uwtable } attributes #0 = { nounwind ssp uwtable }

View File

@ -11,8 +11,8 @@ define coldcc void @bar() {
ret void ret void
} }
define void @structret({ i8 }* sret({ i8 }) %P) { define void @structret(ptr sret({ i8 }) %P) {
call void @structret( { i8 }* sret({ i8 }) %P ) call void @structret( ptr sret({ i8 }) %P )
ret void ret void
} }
@ -25,7 +25,7 @@ define coldcc void @bar2() {
ret void ret void
} }
define cc42 void @bar3() personality i32 (...)* @__gxx_personality_v0 { define cc42 void @bar3() personality ptr @__gxx_personality_v0 {
invoke fastcc void @foo( ) invoke fastcc void @foo( )
to label %Ok unwind label %U to label %Ok unwind label %U
@ -33,12 +33,12 @@ Ok:
ret void ret void
U: U:
%exn = landingpad {i8*, i32} %exn = landingpad {ptr, i32}
cleanup cleanup
resume { i8*, i32 } %exn resume { ptr, i32 } %exn
} }
define void @bar4() personality i32 (...)* @__gxx_personality_v0 { define void @bar4() personality ptr @__gxx_personality_v0 {
call cc42 void @bar( ) call cc42 void @bar( )
invoke cc42 void @bar3( ) invoke cc42 void @bar3( )
to label %Ok unwind label %U to label %Ok unwind label %U
@ -47,9 +47,9 @@ Ok:
ret void ret void
U: U:
%exn = landingpad {i8*, i32} %exn = landingpad {ptr, i32}
cleanup cleanup
resume { i8*, i32 } %exn resume { ptr, i32 } %exn
} }
declare ghccc void @ghc_callee() declare ghccc void @ghc_callee()

View File

@ -4,13 +4,13 @@
%FunTy = type i32 (i32) %FunTy = type i32 (i32)
define void @invoke(%FunTy* %x) { define void @invoke(ptr %x) {
%foo = call i32 %x( i32 123 ) ; <i32> [#uses=0] %foo = call i32 %x( i32 123 ) ; <i32> [#uses=0]
%foo2 = tail call i32 %x( i32 123 ) ; <i32> [#uses=0] %foo2 = tail call i32 %x( i32 123 ) ; <i32> [#uses=0]
ret void ret void
} }
define i32 @main(i32 %argc) personality i32 (...)* @__gxx_personality_v0 { define i32 @main(i32 %argc) personality ptr @__gxx_personality_v0 {
%retval = call i32 @test( i32 %argc ) ; <i32> [#uses=2] %retval = call i32 @test( i32 %argc ) ; <i32> [#uses=2]
%two = add i32 %retval, %retval ; <i32> [#uses=1] %two = add i32 %retval, %retval ; <i32> [#uses=1]
%retval2 = invoke i32 @test( i32 %argc ) %retval2 = invoke i32 @test( i32 %argc )
@ -18,11 +18,11 @@ define i32 @main(i32 %argc) personality i32 (...)* @__gxx_personality_v0 {
Next: Next:
%two2 = add i32 %two, %retval2 ; <i32> [#uses=1] %two2 = add i32 %two, %retval2 ; <i32> [#uses=1]
call void @invoke( %FunTy* @test ) call void @invoke( ptr @test )
ret i32 %two2 ret i32 %two2
Error: Error:
%exn = landingpad {i8*, i32} %exn = landingpad {ptr, i32}
cleanup cleanup
ret i32 -1 ret i32 -1
} }

View File

@ -9,8 +9,8 @@ $f2 = comdat any
@v = global i32 0, comdat($f) @v = global i32 0, comdat($f)
; CHECK: @v = global i32 0, comdat($f) ; CHECK: @v = global i32 0, comdat($f)
@a = alias i32, i32* @v @a = alias i32, ptr @v
; CHECK: @a = alias i32, i32* @v{{$}} ; CHECK: @a = alias i32, ptr @v{{$}}
define void @f() comdat($f) { define void @f() comdat($f) {
ret void ret void

View File

@ -1,8 +1,8 @@
; RUN: llvm-as %s -disable-output ; RUN: llvm-as %s -disable-output
@G = constant <3 x i64> ptrtoint (<3 x i8*> <i8* null, i8* null, i8* null> to <3 x i64>) @G = constant <3 x i64> ptrtoint (<3 x ptr> <ptr null, ptr null, ptr null> to <3 x i64>)
@G1 = global i8 zeroinitializer @G1 = global i8 zeroinitializer
@g = constant <2 x i8*> getelementptr (i8, <2 x i8*> <i8* @G1, i8* @G1>, <2 x i32> <i32 0, i32 0>) @g = constant <2 x ptr> getelementptr (i8, <2 x ptr> <ptr @G1, ptr @G1>, <2 x i32> <i32 0, i32 0>)
@t = constant <2 x i1> icmp eq (<2 x i32> ptrtoint (<2 x i8*> zeroinitializer to <2 x i32>), <2 x i32> zeroinitializer ) @t = constant <2 x i1> icmp eq (<2 x i32> ptrtoint (<2 x ptr> zeroinitializer to <2 x i32>), <2 x i32> zeroinitializer )

View File

@ -10,22 +10,22 @@
; ;
@t3 = global i32* @t1 ;; Forward reference @t3 = global ptr @t1 ;; Forward reference
@t1 = global i32 4 @t1 = global i32 4
@t4 = global i32** @t3 ;; reference to reference @t4 = global ptr @t3 ;; reference to reference
@t2 = global i32* @t1 @t2 = global ptr @t1
@0 = global float * @2 ;; Forward numeric reference @0 = global ptr @2 ;; Forward numeric reference
@1 = global float * @2 ;; Duplicate forward numeric reference @1 = global ptr @2 ;; Duplicate forward numeric reference
@2 = global float 0.0 @2 = global float 0.0
@3 = global float * @2 ;; Numeric reference @3 = global ptr @2 ;; Numeric reference
@fptr = global void() * @f ;; Forward ref method defn @fptr = global ptr @f ;; Forward ref method defn
declare void @f() ;; External method declare void @f() ;; External method
@sptr1 = global [11x i8]* @somestr ;; Forward ref to a constant @sptr1 = global ptr @somestr ;; Forward ref to a constant
@somestr = constant [11x i8] c"hello world" @somestr = constant [11x i8] c"hello world"
@sptr2 = global [11x i8]* @somestr @sptr2 = global ptr @somestr

View File

@ -2,11 +2,11 @@
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll ; RUN: diff %t1.ll %t2.ll
@_ZTIc = external constant i8* @_ZTIc = external constant ptr
@_ZTId = external constant i8* @_ZTId = external constant ptr
@_ZTIPKc = external constant i8* @_ZTIPKc = external constant ptr
define void @_Z3barv() uwtable optsize ssp personality i32 (...)* @__gxx_personality_v0 { define void @_Z3barv() uwtable optsize ssp personality ptr @__gxx_personality_v0 {
entry: entry:
invoke void @_Z3quxv() optsize invoke void @_Z3quxv() optsize
to label %try.cont unwind label %lpad to label %try.cont unwind label %lpad
@ -15,18 +15,18 @@ try.cont: ; preds = %entry, %invoke.cont
ret void ret void
lpad: ; preds = %entry lpad: ; preds = %entry
%exn = landingpad {i8*, i32} %exn = landingpad {ptr, i32}
cleanup cleanup
catch i8** @_ZTIc catch ptr @_ZTIc
filter [2 x i8**] [i8** @_ZTIPKc, i8** @_ZTId] filter [2 x ptr] [ptr @_ZTIPKc, ptr @_ZTId]
resume { i8*, i32 } %exn resume { ptr, i32 } %exn
} }
declare void @_Z3quxv() optsize declare void @_Z3quxv() optsize
declare i32 @__gxx_personality_v0(...) declare i32 @__gxx_personality_v0(...)
define void @cleanupret0() personality i32 (...)* @__gxx_personality_v0 { define void @cleanupret0() personality ptr @__gxx_personality_v0 {
entry: entry:
invoke void @_Z3quxv() optsize invoke void @_Z3quxv() optsize
to label %exit unwind label %pad to label %exit unwind label %pad
@ -38,7 +38,7 @@ exit:
} }
; forward ref by name ; forward ref by name
define void @cleanupret1() personality i32 (...)* @__gxx_personality_v0 { define void @cleanupret1() personality ptr @__gxx_personality_v0 {
entry: entry:
invoke void @_Z3quxv() optsize invoke void @_Z3quxv() optsize
to label %exit unwind label %pad to label %exit unwind label %pad
@ -52,7 +52,7 @@ exit:
} }
; forward ref by ID ; forward ref by ID
define void @cleanupret2() personality i32 (...)* @__gxx_personality_v0 { define void @cleanupret2() personality ptr @__gxx_personality_v0 {
entry: entry:
invoke void @_Z3quxv() optsize invoke void @_Z3quxv() optsize
to label %exit unwind label %pad to label %exit unwind label %pad
@ -65,7 +65,7 @@ exit:
ret void ret void
} }
define void @catchret0() personality i32 (...)* @__gxx_personality_v0 { define void @catchret0() personality ptr @__gxx_personality_v0 {
entry: entry:
invoke void @_Z3quxv() optsize invoke void @_Z3quxv() optsize
to label %exit unwind label %pad to label %exit unwind label %pad
@ -79,7 +79,7 @@ exit:
} }
; forward ref by name ; forward ref by name
define void @catchret1() personality i32 (...)* @__gxx_personality_v0 { define void @catchret1() personality ptr @__gxx_personality_v0 {
entry: entry:
invoke void @_Z3quxv() optsize invoke void @_Z3quxv() optsize
to label %exit unwind label %pad to label %exit unwind label %pad
@ -95,7 +95,7 @@ exit:
} }
; forward ref by ID ; forward ref by ID
define void @catchret2() personality i32 (...)* @__gxx_personality_v0 { define void @catchret2() personality ptr @__gxx_personality_v0 {
entry: entry:
invoke void @_Z3quxv() optsize invoke void @_Z3quxv() optsize
to label %exit unwind label %pad to label %exit unwind label %pad
@ -110,7 +110,7 @@ exit:
ret void ret void
} }
define i8 @catchpad() personality i32 (...)* @__gxx_personality_v0 { define i8 @catchpad() personality ptr @__gxx_personality_v0 {
entry: entry:
invoke void @_Z3quxv() optsize invoke void @_Z3quxv() optsize
to label %exit unwind label %bb2 to label %exit unwind label %bb2
@ -123,7 +123,7 @@ exit:
ret i8 0 ret i8 0
} }
define void @cleanuppad() personality i32 (...)* @__gxx_personality_v0 { define void @cleanuppad() personality ptr @__gxx_personality_v0 {
entry: entry:
br label %try.cont br label %try.cont

View File

@ -4,11 +4,11 @@
%myty = type i32 %myty = type i32
%myfn = type float (i32,double,i32,i16) %myfn = type float (i32,double,i32,i16)
%0 = type i32(%myfn*) %0 = type i32(ptr)
%1 = type i32(i32) %1 = type i32(i32)
%2 = type i32(i32(i32)*) %2 = type i32(ptr)
%thisfuncty = type i32 (i32) * %thisfuncty = type ptr
declare void @F(%thisfuncty, %thisfuncty, %thisfuncty) declare void @F(%thisfuncty, %thisfuncty, %thisfuncty)

View File

@ -2,13 +2,13 @@
; RUN: opt -passes='function(instcombine),globalopt' -S < %s | llvm-as ; RUN: opt -passes='function(instcombine),globalopt' -S < %s | llvm-as
@G1 = global i32 zeroinitializer @G1 = global i32 zeroinitializer
@G2 = global i32 zeroinitializer @G2 = global i32 zeroinitializer
@g = global <2 x i32*> zeroinitializer @g = global <2 x ptr> zeroinitializer
%0 = type { i32, void ()*, i8* } %0 = type { i32, ptr, ptr }
@llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @test, i8* null }] @llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, ptr @test, ptr null }]
define internal void @test() { define internal void @test() {
%A = insertelement <2 x i32*> undef, i32* @G1, i32 0 %A = insertelement <2 x ptr> undef, ptr @G1, i32 0
%B = insertelement <2 x i32*> %A, i32* @G2, i32 1 %B = insertelement <2 x ptr> %A, ptr @G2, i32 1
store <2 x i32*> %B, <2 x i32*>* @g store <2 x ptr> %B, ptr @g
ret void ret void
} }

View File

@ -2,7 +2,7 @@
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll ; RUN: diff %t1.ll %t2.ll
@X = global i32 4, section "foo", align 16 ; <i32*> [#uses=0] @X = global i32 4, section "foo", align 16 ; <ptr> [#uses=0]
define void @test() section "bar" { define void @test() section "bar" {
ret void ret void

View File

@ -2,17 +2,17 @@
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll ; RUN: diff %t1.ll %t2.ll
@MyVar = external global i32 ; <i32*> [#uses=1] @MyVar = external global i32 ; <ptr> [#uses=1]
@MyIntList = external global { i32*, i32 } ; <{ \2*, i32 }*> [#uses=1] @MyIntList = external global { ptr, i32 } ; <ptr> [#uses=1]
@0 = external global i32 ; <i32*>:0 [#uses=0] @0 = external global i32 ; <ptr>:0 [#uses=0]
@AConst = constant i32 123 ; <i32*> [#uses=0] @AConst = constant i32 123 ; <ptr> [#uses=0]
@AString = constant [4 x i8] c"test" ; <[4 x i8]*> [#uses=0] @AString = constant [4 x i8] c"test" ; <ptr> [#uses=0]
@ZeroInit = global { [100 x i32], [40 x float] } zeroinitializer ; <{ [100 x i32], [40 x float] }*> [#uses=0] @ZeroInit = global { [100 x i32], [40 x float] } zeroinitializer ; <ptr> [#uses=0]
define i32 @foo(i32 %blah) { define i32 @foo(i32 %blah) {
store i32 5, i32* @MyVar store i32 5, ptr @MyVar
%idx = getelementptr { i32*, i32 }, { i32*, i32 }* @MyIntList, i64 0, i32 1 ; <i32*> [#uses=1] %idx = getelementptr { ptr, i32 }, ptr @MyIntList, i64 0, i32 1 ; <ptr> [#uses=1]
store i32 12, i32* %idx store i32 12, ptr %idx
ret i32 %blah ret i32 %blah
} }

View File

@ -2,7 +2,7 @@
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll ; RUN: diff %t1.ll %t2.ll
declare i32 @atoi(i8*) declare i32 @atoi(ptr)
define i64 @fib(i64 %n) { define i64 @fib(i64 %n) {
icmp ult i64 %n, 2 ; <i1>:1 [#uses=1] icmp ult i64 %n, 2 ; <i1>:1 [#uses=1]
@ -20,7 +20,7 @@ RecurseCase: ; preds = %0
ret i64 %result ret i64 %result
} }
define i64 @realmain(i32 %argc, i8** %argv) { define i64 @realmain(i32 %argc, ptr %argv) {
; <label>:0 ; <label>:0
icmp eq i32 %argc, 2 ; <i1>:1 [#uses=1] icmp eq i32 %argc, 2 ; <i1>:1 [#uses=1]
br i1 %1, label %HasArg, label %Continue br i1 %1, label %HasArg, label %Continue
@ -36,13 +36,13 @@ Continue: ; preds = %HasArg, %0
ret i64 %F ret i64 %F
} }
define i64 @trampoline(i64 %n, i64 (i64)* %fibfunc) { define i64 @trampoline(i64 %n, ptr %fibfunc) {
%F = call i64 %fibfunc( i64 %n ) ; <i64> [#uses=1] %F = call i64 %fibfunc( i64 %n ) ; <i64> [#uses=1]
ret i64 %F ret i64 %F
} }
define i32 @main() { define i32 @main() {
%Result = call i64 @trampoline( i64 10, i64 (i64)* @fib ) ; <i64> [#uses=1] %Result = call i64 @trampoline( i64 10, ptr @fib ) ; <i64> [#uses=1]
%Result.upgrd.1 = trunc i64 %Result to i32 ; <i32> [#uses=1] %Result.upgrd.1 = trunc i64 %Result to i32 ; <i32> [#uses=1]
ret i32 %Result.upgrd.1 ret i32 %Result.upgrd.1
} }

View File

@ -16,7 +16,7 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu" target triple = "x86_64-unknown-linux-gnu"
@junk = global i32 0 @junk = global i32 0
define i32* @somefunk() { define ptr @somefunk() {
ret i32* @junk ret ptr @junk
} }

View File

@ -3,16 +3,16 @@
define i32 @foo() nounwind ssp { define i32 @foo() nounwind ssp {
entry: entry:
; CHECK: %retval = alloca i32 ; CHECK: %retval = alloca i32
; CHECK: store i32 42, i32* %retval, align 4, !md !0 ; CHECK: store i32 42, ptr %retval, align 4, !md !0
; CHECK: br label %0, !md !1 ; CHECK: br label %0, !md !1
%retval = alloca i32 %retval = alloca i32
store i32 42, i32* %retval, !md !0 store i32 42, ptr %retval, !md !0
br label %0, !md !1 br label %0, !md !1
; <label:0> ; <label:0>
; CHECK: %1 = load i32, i32* %retval, align 4, !md !2 ; CHECK: %1 = load i32, ptr %retval, align 4, !md !2
; CHECK: ret i32 %1, !md !3 ; CHECK: ret i32 %1, !md !3
%1 = load i32, i32* %retval, !md !2 %1 = load i32, ptr %retval, !md !2
ret i32 %1, !md !3 ret i32 %1, !md !3
} }

View File

@ -2,35 +2,34 @@
%"struct.std::pair<int,int>" = type { i32, i32 } %"struct.std::pair<int,int>" = type { i32, i32 }
declare void @_Z3barRKi(i32*) declare void @_Z3barRKi(ptr)
declare void @llvm.lifetime.start(i64, i8* nocapture) nounwind declare void @llvm.lifetime.start(i64, ptr nocapture) nounwind
declare void @llvm.lifetime.end(i64, i8* nocapture) nounwind declare void @llvm.lifetime.end(i64, ptr nocapture) nounwind
declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) readonly nounwind declare ptr @llvm.invariant.start.p0(i64, ptr nocapture) readonly nounwind
declare void @llvm.invariant.end.p0i8({}*, i64, i8* nocapture) nounwind declare void @llvm.invariant.end.p0(ptr, i64, ptr nocapture) nounwind
define i32 @_Z4foo2v() nounwind { define i32 @_Z4foo2v() nounwind {
entry: entry:
%x = alloca %"struct.std::pair<int,int>" %x = alloca %"struct.std::pair<int,int>"
%y = bitcast %"struct.std::pair<int,int>"* %x to i8*
;; Constructor starts here (this isn't needed since it is immediately ;; Constructor starts here (this isn't needed since it is immediately
;; preceded by an alloca, but shown for completeness). ;; preceded by an alloca, but shown for completeness).
call void @llvm.lifetime.start(i64 8, i8* %y) call void @llvm.lifetime.start(i64 8, ptr %x)
%0 = getelementptr %"struct.std::pair<int,int>", %"struct.std::pair<int,int>"* %x, i32 0, i32 0 %0 = getelementptr %"struct.std::pair<int,int>", ptr %x, i32 0, i32 0
store i32 4, i32* %0, align 8 store i32 4, ptr %0, align 8
%1 = getelementptr %"struct.std::pair<int,int>", %"struct.std::pair<int,int>"* %x, i32 0, i32 1 %1 = getelementptr %"struct.std::pair<int,int>", ptr %x, i32 0, i32 1
store i32 5, i32* %1, align 4 store i32 5, ptr %1, align 4
;; Constructor has finished here. ;; Constructor has finished here.
%inv = call {}* @llvm.invariant.start.p0i8(i64 8, i8* %y) %inv = call ptr @llvm.invariant.start.p0(i64 8, ptr %x)
call void @_Z3barRKi(i32* %0) nounwind call void @_Z3barRKi(ptr %0) nounwind
%2 = load i32, i32* %0, align 8 %2 = load i32, ptr %0, align 8
;; Destructor is run here. ;; Destructor is run here.
call void @llvm.invariant.end.p0i8({}* %inv, i64 8, i8* %y) call void @llvm.invariant.end.p0(ptr %inv, i64 8, ptr %x)
;; Destructor is done here. ;; Destructor is done here.
call void @llvm.lifetime.end(i64 8, i8* %y) call void @llvm.lifetime.end(i64 8, ptr %x)
ret i32 %2 ret i32 %2
} }

View File

@ -3,8 +3,8 @@
define void @foo(i32 %x) { define void @foo(i32 %x) {
call void @llvm.zonk(metadata i32 %x, i64 0, metadata !1) call void @llvm.zonk(metadata i32 %x, i64 0, metadata !1)
store i32 0, i32* null, !whatever !0, !whatever_else !{}, !more !{!"hello"} store i32 0, ptr null, !whatever !0, !whatever_else !{}, !more !{!"hello"}
store i32 0, i32* null, !whatever !{!"hello", !1, !{}, !2} store i32 0, ptr null, !whatever !{!"hello", !1, !{}, !2}
ret void, !_1 !0 ret void, !_1 !0
} }
@ -12,6 +12,6 @@ declare void @llvm.zonk(metadata, i64, metadata) nounwind readnone
!named = !{!0} !named = !{!0}
!another_named = !{} !another_named = !{}
!0 = !{i8** null} !0 = !{ptr null}
!1 = !{i8* null, !2} !1 = !{ptr null, !2}
!2 = !{} !2 = !{}

View File

@ -13,16 +13,16 @@ define void @"NewCasts" (i16 %x) {
%i = fpext float %d to double %i = fpext float %d to double
%j = fptrunc double %i to float %j = fptrunc double %i to float
%k = bitcast i32 %a to float %k = bitcast i32 %a to float
%l = inttoptr i16 %x to i32* %l = inttoptr i16 %x to ptr
%m = ptrtoint i32* %l to i64 %m = ptrtoint ptr %l to i64
%n = insertelement <4 x i32> undef, i32 %a, i32 0 %n = insertelement <4 x i32> undef, i32 %a, i32 0
%o = sitofp <4 x i32> %n to <4 x float> %o = sitofp <4 x i32> %n to <4 x float>
%p = uitofp <4 x i32> %n to <4 x float> %p = uitofp <4 x i32> %n to <4 x float>
%q = fptosi <4 x float> %p to <4 x i32> %q = fptosi <4 x float> %p to <4 x i32>
%r = fptoui <4 x float> %p to <4 x i32> %r = fptoui <4 x float> %p to <4 x i32>
%s = inttoptr <4 x i32> %n to <4 x i32*> %s = inttoptr <4 x i32> %n to <4 x ptr>
%t = addrspacecast <4 x i32*> %s to <4 x i32 addrspace(1)*> %t = addrspacecast <4 x ptr> %s to <4 x ptr addrspace(1)>
%z = addrspacecast <4 x i32*> %s to <4 x float addrspace(2)*> %z = addrspacecast <4 x ptr> %s to <4 x ptr addrspace(2)>
ret void ret void
} }

View File

@ -15,13 +15,13 @@
define i32 @_Z3fooi(i32 %x) #0 { define i32 @_Z3fooi(i32 %x) #0 {
entry: entry:
%x.addr = alloca i32, align 4 %x.addr = alloca i32, align 4
store i32 %x, i32* %x.addr, align 4 store i32 %x, ptr %x.addr, align 4
br label %while.cond br label %while.cond
while.cond: ; preds = %while.body, %entry while.cond: ; preds = %while.body, %entry
%0 = load i32, i32* %x.addr, align 4 %0 = load i32, ptr %x.addr, align 4
%dec = add nsw i32 %0, -1 %dec = add nsw i32 %0, -1
store i32 %dec, i32* %x.addr, align 4 store i32 %dec, ptr %x.addr, align 4
%tobool = icmp ne i32 %0, 0 %tobool = icmp ne i32 %0, 0
br i1 %tobool, label %while.body, label %while.end br i1 %tobool, label %while.body, label %while.end

View File

@ -15,13 +15,13 @@
define i32 @foo(i32 %x) #0 { define i32 @foo(i32 %x) #0 {
entry: entry:
%x.addr = alloca i32, align 4 %x.addr = alloca i32, align 4
store i32 %x, i32* %x.addr, align 4 store i32 %x, ptr %x.addr, align 4
br label %while.cond br label %while.cond
while.cond: ; preds = %while.body, %entry while.cond: ; preds = %while.body, %entry
%0 = load i32, i32* %x.addr, align 4 %0 = load i32, ptr %x.addr, align 4
%dec = add nsw i32 %0, -1 %dec = add nsw i32 %0, -1
store i32 %dec, i32* %x.addr, align 4 store i32 %dec, ptr %x.addr, align 4
%tobool = icmp ne i32 %0, 0 %tobool = icmp ne i32 %0, 0
br i1 %tobool, label %while.body, label %while.end br i1 %tobool, label %while.body, label %while.end

View File

@ -2,14 +2,14 @@
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll ; RUN: diff %t1.ll %t2.ll
@foo1 = external global <4 x float> ; <<4 x float>*> [#uses=2] @foo1 = external global <4 x float> ; <ptr> [#uses=2]
@foo2 = external global <2 x i32> ; <<2 x i32>*> [#uses=2] @foo2 = external global <2 x i32> ; <ptr> [#uses=2]
define void @main() { define void @main() {
store <4 x float> < float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00 >, <4 x float>* @foo1 store <4 x float> < float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00 >, ptr @foo1
store <2 x i32> < i32 4, i32 4 >, <2 x i32>* @foo2 store <2 x i32> < i32 4, i32 4 >, ptr @foo2
%l1 = load <4 x float>, <4 x float>* @foo1 ; <<4 x float>> [#uses=0] %l1 = load <4 x float>, ptr @foo1 ; <<4 x float>> [#uses=0]
%l2 = load <2 x i32>, <2 x i32>* @foo2 ; <<2 x i32>> [#uses=0] %l2 = load <2 x i32>, ptr @foo2 ; <<2 x i32>> [#uses=0]
ret void ret void
} }

View File

@ -16,9 +16,9 @@
define i32 @main() define i32 @main()
{ {
%tmp = load i32, i32* getelementptr (%struct.anon, %struct.anon* @foos, i32 0, i32 1) ; <i32> [#uses=1] %tmp = load i32, ptr getelementptr (%struct.anon, ptr @foos, i32 0, i32 1) ; <i32> [#uses=1]
%tmp3 = load i32, i32* getelementptr (%struct.anon, %struct.anon* @foos, i32 0, i32 2) ; <i32> [#uses=1] %tmp3 = load i32, ptr getelementptr (%struct.anon, ptr @foos, i32 0, i32 2) ; <i32> [#uses=1]
%tmp6 = load i32, i32* getelementptr (%struct.anon, %struct.anon* @foos, i32 0, i32 3) ; <i32> [#uses=1] %tmp6 = load i32, ptr getelementptr (%struct.anon, ptr @foos, i32 0, i32 3) ; <i32> [#uses=1]
%tmp4 = add i32 %tmp3, %tmp ; <i32> [#uses=1] %tmp4 = add i32 %tmp3, %tmp ; <i32> [#uses=1]
%tmp7 = add i32 %tmp4, %tmp6 ; <i32> [#uses=1] %tmp7 = add i32 %tmp4, %tmp6 ; <i32> [#uses=1]
ret i32 %tmp7 ret i32 %tmp7
@ -26,8 +26,8 @@ define i32 @main()
define i32 @bar() { define i32 @bar() {
entry: entry:
%tmp = load i32, i32* getelementptr([2 x <{ i32, i8 }>], [2 x <{ i32, i8 }>]* @bara, i32 0, i32 0, i32 0 ) ; <i32> [#uses=1] %tmp = load i32, ptr getelementptr([2 x <{ i32, i8 }>], ptr @bara, i32 0, i32 0, i32 0 ) ; <i32> [#uses=1]
%tmp4 = load i32, i32* getelementptr ([2 x <{ i32, i8 }>], [2 x <{ i32, i8 }>]* @bara, i32 0, i32 1, i32 0) ; <i32> [#uses=1] %tmp4 = load i32, ptr getelementptr ([2 x <{ i32, i8 }>], ptr @bara, i32 0, i32 1, i32 0) ; <i32> [#uses=1]
%tmp5 = add i32 %tmp4, %tmp ; <i32> [#uses=1] %tmp5 = add i32 %tmp4, %tmp ; <i32> [#uses=1]
ret i32 %tmp5 ret i32 %tmp5
} }

View File

@ -8,11 +8,11 @@
declare signext i16 @"test"(i16 signext %arg) declare signext i16 @"test"(i16 signext %arg)
declare zeroext i8 @"test2" (i16 zeroext %a2) declare zeroext i8 @"test2" (i16 zeroext %a2)
declare i32 @"test3"(i32* noalias %p) declare i32 @"test3"(ptr noalias %p)
declare void @exit(i32) noreturn nounwind declare void @exit(i32) noreturn nounwind
define i32 @main(i32 inreg %argc, i8 ** inreg %argv) nounwind { define i32 @main(i32 inreg %argc, ptr inreg %argv) nounwind {
%val = trunc i32 %argc to i16 %val = trunc i32 %argc to i16
%res1 = call signext i16 (i16 )@test(i16 signext %val) %res1 = call signext i16 (i16 )@test(i16 signext %val)
%two = add i16 %res1, %res1 %two = add i16 %res1, %res1

View File

@ -4,23 +4,23 @@
; ModuleID = '<stdin>' ; ModuleID = '<stdin>'
target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
target triple = "powerpc-apple-darwin8" target triple = "powerpc-apple-darwin8"
@ld = external global ppc_fp128 ; <ppc_fp128*> [#uses=1] @ld = external global ppc_fp128 ; <ptr> [#uses=1]
@d = global double 4.050000e+00, align 8 ; <double*> [#uses=1] @d = global double 4.050000e+00, align 8 ; <ptr> [#uses=1]
@f = global float 0x4010333340000000 ; <float*> [#uses=1] @f = global float 0x4010333340000000 ; <ptr> [#uses=1]
define i32 @foo() { define i32 @foo() {
entry: entry:
%retval = alloca i32, align 4 ; <i32*> [#uses=1] %retval = alloca i32, align 4 ; <ptr> [#uses=1]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%tmp = load float, float* @f ; <float> [#uses=1] %tmp = load float, ptr @f ; <float> [#uses=1]
%tmp1 = fpext float %tmp to double ; <double> [#uses=1] %tmp1 = fpext float %tmp to double ; <double> [#uses=1]
%tmp2 = load double, double* @d ; <double> [#uses=1] %tmp2 = load double, ptr @d ; <double> [#uses=1]
%tmp3 = fmul double %tmp1, %tmp2 ; <double> [#uses=1] %tmp3 = fmul double %tmp1, %tmp2 ; <double> [#uses=1]
%tmp4 = fpext double %tmp3 to ppc_fp128 ; <ppc_fp128> [#uses=1] %tmp4 = fpext double %tmp3 to ppc_fp128 ; <ppc_fp128> [#uses=1]
store ppc_fp128 %tmp4, ppc_fp128* @ld store ppc_fp128 %tmp4, ptr @ld
br label %return br label %return
return: ; preds = %entry return: ; preds = %entry
%retval4 = load i32, i32* %retval ; <i32> [#uses=1] %retval4 = load i32, ptr %retval ; <i32> [#uses=1]
ret i32 %retval4 ret i32 %retval4
} }

View File

@ -12,7 +12,7 @@ define void @f() prefix i32 1 {
ret void ret void
} }
; CHECK: g(){{.*}}prefix i32* @i ; CHECK: g(){{.*}}prefix ptr @i
define void @g() prefix i32* @i { define void @g() prefix ptr @i {
ret void ret void
} }

View File

@ -12,7 +12,7 @@ define void @f() prologue i32 1 {
ret void ret void
} }
; CHECK: g(){{.*}}prologue i32* @i ; CHECK: g(){{.*}}prologue ptr @i
define void @g() prologue i32* @i { define void @g() prologue ptr @i {
ret void ret void
} }

View File

@ -37,67 +37,63 @@
; if (FindData(MyList, 700)) foundIt(); ; if (FindData(MyList, 700)) foundIt();
; } ; }
%list = type { %list*, i32 } %list = type { ptr, i32 }
declare i8* @malloc(i32) declare ptr @malloc(i32)
define void @InsertIntoListTail(%list** %L, i32 %Data) { define void @InsertIntoListTail(ptr %L, i32 %Data) {
bb1: bb1:
%reg116 = load %list*, %list** %L ; <%list*> [#uses=1] %reg116 = load ptr, ptr %L ; <ptr> [#uses=1]
%cast1004 = inttoptr i64 0 to %list* ; <%list*> [#uses=1] %cast1004 = inttoptr i64 0 to ptr ; <ptr> [#uses=1]
%cond1000 = icmp eq %list* %reg116, %cast1004 ; <i1> [#uses=1] %cond1000 = icmp eq ptr %reg116, %cast1004 ; <i1> [#uses=1]
br i1 %cond1000, label %bb3, label %bb2 br i1 %cond1000, label %bb3, label %bb2
bb2: ; preds = %bb2, %bb1 bb2: ; preds = %bb2, %bb1
%reg117 = phi %list** [ %reg118, %bb2 ], [ %L, %bb1 ] ; <%list**> [#uses=1] %reg117 = phi ptr [ %reg118, %bb2 ], [ %L, %bb1 ] ; <ptr> [#uses=1]
%cast1010 = bitcast %list** %reg117 to %list*** ; <%list***> [#uses=1] %reg118 = load ptr, ptr %reg117 ; <ptr> [#uses=3]
%reg118 = load %list**, %list*** %cast1010 ; <%list**> [#uses=3] %reg109 = load ptr, ptr %reg118 ; <ptr> [#uses=1]
%reg109 = load %list*, %list** %reg118 ; <%list*> [#uses=1] %cast1005 = inttoptr i64 0 to ptr ; <ptr> [#uses=1]
%cast1005 = inttoptr i64 0 to %list* ; <%list*> [#uses=1] %cond1001 = icmp ne ptr %reg109, %cast1005 ; <i1> [#uses=1]
%cond1001 = icmp ne %list* %reg109, %cast1005 ; <i1> [#uses=1]
br i1 %cond1001, label %bb2, label %bb3 br i1 %cond1001, label %bb2, label %bb3
bb3: ; preds = %bb2, %bb1 bb3: ; preds = %bb2, %bb1
%reg119 = phi %list** [ %reg118, %bb2 ], [ %L, %bb1 ] ; <%list**> [#uses=1] %reg119 = phi ptr [ %reg118, %bb2 ], [ %L, %bb1 ] ; <ptr> [#uses=1]
%cast1006 = bitcast %list** %reg119 to i8** ; <i8**> [#uses=1] %reg111 = call ptr @malloc( i32 16 ) ; <ptr> [#uses=3]
%reg111 = call i8* @malloc( i32 16 ) ; <i8*> [#uses=3] store ptr %reg111, ptr %reg119
store i8* %reg111, i8** %cast1006 %reg111.upgrd.1 = ptrtoint ptr %reg111 to i64 ; <i64> [#uses=1]
%reg111.upgrd.1 = ptrtoint i8* %reg111 to i64 ; <i64> [#uses=1]
%reg1002 = add i64 %reg111.upgrd.1, 8 ; <i64> [#uses=1] %reg1002 = add i64 %reg111.upgrd.1, 8 ; <i64> [#uses=1]
%reg1002.upgrd.2 = inttoptr i64 %reg1002 to i8* ; <i8*> [#uses=1] %reg1002.upgrd.2 = inttoptr i64 %reg1002 to ptr ; <ptr> [#uses=1]
%cast1008 = bitcast i8* %reg1002.upgrd.2 to i32* ; <i32*> [#uses=1] store i32 %Data, ptr %reg1002.upgrd.2
store i32 %Data, i32* %cast1008 %cast1003 = inttoptr i64 0 to ptr ; <ptr> [#uses=1]
%cast1003 = inttoptr i64 0 to i64* ; <i64*> [#uses=1] store ptr %cast1003, ptr %reg111
%cast1009 = bitcast i8* %reg111 to i64** ; <i64**> [#uses=1]
store i64* %cast1003, i64** %cast1009
ret void ret void
} }
define %list* @FindData(%list* %L, i32 %Data) { define ptr @FindData(ptr %L, i32 %Data) {
bb1: bb1:
br label %bb2 br label %bb2
bb2: ; preds = %bb6, %bb1 bb2: ; preds = %bb6, %bb1
%reg115 = phi %list* [ %reg116, %bb6 ], [ %L, %bb1 ] ; <%list*> [#uses=4] %reg115 = phi ptr [ %reg116, %bb6 ], [ %L, %bb1 ] ; <ptr> [#uses=4]
%cast1014 = inttoptr i64 0 to %list* ; <%list*> [#uses=1] %cast1014 = inttoptr i64 0 to ptr ; <ptr> [#uses=1]
%cond1011 = icmp ne %list* %reg115, %cast1014 ; <i1> [#uses=1] %cond1011 = icmp ne ptr %reg115, %cast1014 ; <i1> [#uses=1]
br i1 %cond1011, label %bb4, label %bb3 br i1 %cond1011, label %bb4, label %bb3
bb3: ; preds = %bb2 bb3: ; preds = %bb2
ret %list* null ret ptr null
bb4: ; preds = %bb2 bb4: ; preds = %bb2
%idx = getelementptr %list, %list* %reg115, i64 0, i32 1 ; <i32*> [#uses=1] %idx = getelementptr %list, ptr %reg115, i64 0, i32 1 ; <ptr> [#uses=1]
%reg111 = load i32, i32* %idx ; <i32> [#uses=1] %reg111 = load i32, ptr %idx ; <i32> [#uses=1]
%cond1013 = icmp ne i32 %reg111, %Data ; <i1> [#uses=1] %cond1013 = icmp ne i32 %reg111, %Data ; <i1> [#uses=1]
br i1 %cond1013, label %bb6, label %bb5 br i1 %cond1013, label %bb6, label %bb5
bb5: ; preds = %bb4 bb5: ; preds = %bb4
ret %list* %reg115 ret ptr %reg115
bb6: ; preds = %bb4 bb6: ; preds = %bb4
%idx2 = getelementptr %list, %list* %reg115, i64 0, i32 0 ; <%list**> [#uses=1] %idx2 = getelementptr %list, ptr %reg115, i64 0, i32 0 ; <ptr> [#uses=1]
%reg116 = load %list*, %list** %idx2 ; <%list*> [#uses=1] %reg116 = load ptr, ptr %idx2 ; <ptr> [#uses=1]
br label %bb2 br label %bb2
} }

View File

@ -11,14 +11,14 @@ entry:
ret i32 %div ret i32 %div
} }
define i32 @main() nounwind personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) { define i32 @main() nounwind personality ptr @__C_specific_handler {
entry: entry:
%call = invoke i32 @div(i32 10, i32 0) %call = invoke i32 @div(i32 10, i32 0)
to label %__try.cont unwind label %lpad to label %__try.cont unwind label %lpad
lpad: lpad:
%0 = landingpad { i8*, i32 } %0 = landingpad { ptr, i32 }
catch i8* null catch ptr null
br label %__try.cont br label %__try.cont
__try.cont: __try.cont:

View File

@ -4,17 +4,17 @@
%FunTy = type i32 (i32) %FunTy = type i32 (i32)
define void @invoke(%FunTy* %x) { define void @invoke(ptr %x) {
%foo = call i32 %x( i32 123 ) ; <i32> [#uses=0] %foo = call i32 %x( i32 123 ) ; <i32> [#uses=0]
ret void ret void
} }
define i32 @main(i32 %argc, i8** %argv, i8** %envp) { define i32 @main(i32 %argc, ptr %argv, ptr %envp) {
%retval = call i32 @test( i32 %argc ) ; <i32> [#uses=2] %retval = call i32 @test( i32 %argc ) ; <i32> [#uses=2]
%two = add i32 %retval, %retval ; <i32> [#uses=1] %two = add i32 %retval, %retval ; <i32> [#uses=1]
%retval2 = call i32 @test( i32 %argc ) ; <i32> [#uses=1] %retval2 = call i32 @test( i32 %argc ) ; <i32> [#uses=1]
%two2 = add i32 %two, %retval2 ; <i32> [#uses=1] %two2 = add i32 %two, %retval2 ; <i32> [#uses=1]
call void @invoke( %FunTy* @test ) call void @invoke( ptr @test )
ret i32 %two2 ret i32 %two2
} }

View File

@ -2,23 +2,23 @@
; RUN: llvm-as < %t | llvm-dis > %t2 ; RUN: llvm-as < %t | llvm-dis > %t2
; RUN: diff %t %t2 ; RUN: diff %t %t2
; ModuleID = '<stdin>' ; ModuleID = '<stdin>'
@ld = external global fp128 ; <fp128*> [#uses=1] @ld = external global fp128 ; <ptr> [#uses=1]
@d = global double 4.050000e+00, align 8 ; <double*> [#uses=1] @d = global double 4.050000e+00, align 8 ; <ptr> [#uses=1]
@f = global float 0x4010333340000000 ; <float*> [#uses=1] @f = global float 0x4010333340000000 ; <ptr> [#uses=1]
define i32 @foo() { define i32 @foo() {
entry: entry:
%retval = alloca i32, align 4 ; <i32*> [#uses=1] %retval = alloca i32, align 4 ; <ptr> [#uses=1]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%tmp = load float, float* @f ; <float> [#uses=1] %tmp = load float, ptr @f ; <float> [#uses=1]
%tmp1 = fpext float %tmp to double ; <double> [#uses=1] %tmp1 = fpext float %tmp to double ; <double> [#uses=1]
%tmp2 = load double, double* @d ; <double> [#uses=1] %tmp2 = load double, ptr @d ; <double> [#uses=1]
%tmp3 = fmul double %tmp1, %tmp2 ; <double> [#uses=1] %tmp3 = fmul double %tmp1, %tmp2 ; <double> [#uses=1]
%tmp4 = fpext double %tmp3 to fp128 ; <fp128> [#uses=1] %tmp4 = fpext double %tmp3 to fp128 ; <fp128> [#uses=1]
store fp128 %tmp4, fp128* @ld store fp128 %tmp4, ptr @ld
br label %return br label %return
return: ; preds = %entry return: ; preds = %entry
%retval4 = load i32, i32* %retval ; <i32> [#uses=1] %retval4 = load i32, ptr %retval ; <i32> [#uses=1]
ret i32 %retval4 ret i32 %retval4
} }

View File

@ -5,14 +5,14 @@
; CHECK: @GlobalValueName ; CHECK: @GlobalValueName
; CHECK: @foo(i32 %in) ; CHECK: @foo(i32 %in)
; CHECK: somelabel: ; CHECK: somelabel:
; CHECK: %GV = load i32, i32* @GlobalValueName ; CHECK: %GV = load i32, ptr @GlobalValueName
; CHECK: %add = add i32 %in, %GV ; CHECK: %add = add i32 %in, %GV
; CHECK: ret i32 %add ; CHECK: ret i32 %add
; NONAME: @GlobalValueName ; NONAME: @GlobalValueName
; NONAME: @foo(i32 %0) ; NONAME: @foo(i32 %0)
; NONAME-NOT: somelabel: ; NONAME-NOT: somelabel:
; NONAME: %2 = load i32, i32* @GlobalValueName ; NONAME: %2 = load i32, ptr @GlobalValueName
; NONAME: %3 = add i32 %0, %2 ; NONAME: %3 = add i32 %0, %2
; NONAME: ret i32 %3 ; NONAME: ret i32 %3
@ -20,7 +20,7 @@
define i32 @foo(i32 %in) { define i32 @foo(i32 %in) {
somelabel: somelabel:
%GV = load i32, i32* @GlobalValueName %GV = load i32, ptr @GlobalValueName
%add = add i32 %in, %GV %add = add i32 %in, %GV
ret i32 %add ret i32 %add
} }

View File

@ -25,17 +25,17 @@ Case4: ; preds = %0
} }
@Addr = global i8* blockaddress(@indbrtest, %BB1) @Addr = global ptr blockaddress(@indbrtest, %BB1)
@Addr3 = global i8* blockaddress(@squared, %Case1) @Addr3 = global ptr blockaddress(@squared, %Case1)
define i32 @indbrtest(i8* %P, i32* %Q) { define i32 @indbrtest(ptr %P, ptr %Q) {
indirectbr i8* %P, [label %BB1, label %BB2, label %BB3] indirectbr ptr %P, [label %BB1, label %BB2, label %BB3]
BB1: BB1:
indirectbr i32* %Q, [] indirectbr ptr %Q, []
BB2: BB2:
%R = bitcast i8* blockaddress(@indbrtest, %BB3) to i8* %R = bitcast ptr blockaddress(@indbrtest, %BB3) to ptr
indirectbr i8* %R, [label %BB1, label %BB2, label %BB3] indirectbr ptr %R, [label %BB1, label %BB2, label %BB3]
BB3: BB3:
ret i32 2 ret i32 2
} }

View File

@ -2,21 +2,21 @@
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll ; RUN: diff %t1.ll %t2.ll
@somestr = constant [11 x i8] c"hello world" ; <[11 x i8]*> [#uses=1] @somestr = constant [11 x i8] c"hello world" ; <ptr> [#uses=1]
@array = constant [2 x i32] [ i32 12, i32 52 ] ; <[2 x i32]*> [#uses=1] @array = constant [2 x i32] [ i32 12, i32 52 ] ; <ptr> [#uses=1]
@0 = constant { i32, i32 } { i32 4, i32 3 } ; <{ i32, i32 }*>:0 [#uses=0] @0 = constant { i32, i32 } { i32 4, i32 3 } ; <ptr>:0 [#uses=0]
define [2 x i32]* @testfunction(i32 %i0, i32 %j0) { define ptr @testfunction(i32 %i0, i32 %j0) {
ret [2 x i32]* @array ret ptr @array
} }
define i8* @otherfunc(i32, double) { define ptr @otherfunc(i32, double) {
%somestr = getelementptr [11 x i8], [11 x i8]* @somestr, i64 0, i64 0 ; <i8*> [#uses=1] %somestr = getelementptr [11 x i8], ptr @somestr, i64 0, i64 0 ; <ptr> [#uses=1]
ret i8* %somestr ret ptr %somestr
} }
define i8* @yetanotherfunc(i32, double) { define ptr @yetanotherfunc(i32, double) {
ret i8* null ret ptr null
} }
define i32 @negativeUnsigned() { define i32 @negativeUnsigned() {

View File

@ -2,20 +2,20 @@
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll ; RUN: diff %t1.ll %t2.ll
%X = type i32* addrspace(4)* %X = type ptr addrspace(4)
%inners = type { float, { i8 } } %inners = type { float, { i8 } }
%struct = type { i32, %inners, i64 } %struct = type { i32, %inners, i64 }
%fwd = type %fwdref* %fwd = type ptr
%fwdref = type { %fwd* } %fwdref = type { ptr }
; same as above with unnamed types ; same as above with unnamed types
%1 = type %0* %1 = type ptr
%test = type %1 %test = type %1
%0 = type { %1* } %0 = type { ptr }
%test2 = type [2 x i32] %test2 = type [2 x i32]
;%x = type %undefined* ;%x = type ptr
%test3 = type i32 (i32()*, float(...)*, ...)* %test3 = type ptr

View File

@ -3,10 +3,10 @@
; RUN: diff %t1.ll %t2.ll ; RUN: diff %t1.ll %t2.ll
declare i32 @printf(i8*, ...) ;; Prototype for: int __builtin_printf(const char*, ...) declare i32 @printf(ptr, ...) ;; Prototype for: int __builtin_printf(const char*, ...)
define i32 @testvarar() { define i32 @testvarar() {
call i32 (i8*, ...) @printf( i8* null, i32 12, i8 42 ) ; <i32>:1 [#uses=1] call i32 (ptr, ...) @printf( ptr null, i32 12, i8 42 ) ; <i32>:1 [#uses=1]
ret i32 %1 ret i32 %1
} }

View File

@ -3,9 +3,9 @@
; RUN: diff %t1.ll %t2.ll ; RUN: diff %t1.ll %t2.ll
; RUN: FileCheck %s < %t1.ll ; RUN: FileCheck %s < %t1.ll
@X = global i32 undef ; <i32*> [#uses=0] @X = global i32 undef ; <ptr> [#uses=0]
declare i32 @atoi(i8*) declare i32 @atoi(ptr)
define i32 @test() { define i32 @test() {
ret i32 undef ret i32 undef
@ -21,7 +21,7 @@ define i32 @test2() {
; CHECK: @X = global ; CHECK: @X = global
; CHECK-EMPTY: ; CHECK-EMPTY:
; CHECK: declare i32 @atoi(i8*) ; CHECK: declare i32 @atoi(ptr)
; CHECK-EMPTY: ; CHECK-EMPTY:
; CHECK: define i32 @test() { ; CHECK: define i32 @test() {
; CHECK: {{^[}]}} ; CHECK: {{^[}]}}

View File

@ -5,25 +5,20 @@
; Demonstrate all of the variable argument handling intrinsic functions plus ; Demonstrate all of the variable argument handling intrinsic functions plus
; the va_arg instruction. ; the va_arg instruction.
declare void @llvm.va_start(i8*) declare void @llvm.va_start(ptr)
declare void @llvm.va_copy(i8*, i8*) declare void @llvm.va_copy(ptr, ptr)
declare void @llvm.va_end(i8*) declare void @llvm.va_end(ptr)
define i32 @test(i32 %X, ...) { define i32 @test(i32 %X, ...) {
%ap = alloca i8* ; <i8**> [#uses=4] %ap = alloca ptr ; <ptr> [#uses=4]
%va.upgrd.1 = bitcast i8** %ap to i8* ; <i8*> [#uses=1] call void @llvm.va_start( ptr %ap )
call void @llvm.va_start( i8* %va.upgrd.1 ) %tmp = va_arg ptr %ap, i32 ; <i32> [#uses=1]
%tmp = va_arg i8** %ap, i32 ; <i32> [#uses=1] %aq = alloca ptr ; <ptr> [#uses=2]
%aq = alloca i8* ; <i8**> [#uses=2] call void @llvm.va_copy( ptr %aq, ptr %ap )
%va0.upgrd.2 = bitcast i8** %aq to i8* ; <i8*> [#uses=1] call void @llvm.va_end( ptr %aq )
%va1.upgrd.3 = bitcast i8** %ap to i8* ; <i8*> [#uses=1] call void @llvm.va_end( ptr %ap )
call void @llvm.va_copy( i8* %va0.upgrd.2, i8* %va1.upgrd.3 )
%va.upgrd.4 = bitcast i8** %aq to i8* ; <i8*> [#uses=1]
call void @llvm.va_end( i8* %va.upgrd.4 )
%va.upgrd.5 = bitcast i8** %ap to i8* ; <i8*> [#uses=1]
call void @llvm.va_end( i8* %va.upgrd.5 )
ret i32 %tmp ret i32 %tmp
} }

View File

@ -5,34 +5,29 @@
; Demonstrate all of the variable argument handling intrinsic functions plus ; Demonstrate all of the variable argument handling intrinsic functions plus
; the va_arg instruction. ; the va_arg instruction.
declare void @llvm.va_start(i8*) declare void @llvm.va_start(ptr)
declare void @llvm.va_copy(i8*, i8*) declare void @llvm.va_copy(ptr, ptr)
declare void @llvm.va_end(i8*) declare void @llvm.va_end(ptr)
define i32 @test(i32 %X, ...) { define i32 @test(i32 %X, ...) {
; Allocate two va_list items. On this target, va_list is of type sbyte* ; Allocate two va_list items. On this target, va_list is of type sbyte*
%ap = alloca i8* ; <i8**> [#uses=4] %ap = alloca ptr ; <ptr> [#uses=4]
%aq = alloca i8* ; <i8**> [#uses=2] %aq = alloca ptr ; <ptr> [#uses=2]
; Initialize variable argument processing ; Initialize variable argument processing
%va.upgrd.1 = bitcast i8** %ap to i8* ; <i8*> [#uses=1] call void @llvm.va_start( ptr %ap )
call void @llvm.va_start( i8* %va.upgrd.1 )
; Read a single integer argument ; Read a single integer argument
%tmp = va_arg i8** %ap, i32 ; <i32> [#uses=1] %tmp = va_arg ptr %ap, i32 ; <i32> [#uses=1]
; Demonstrate usage of llvm.va_copy and llvm_va_end ; Demonstrate usage of llvm.va_copy and llvm_va_end
%apv = load i8*, i8** %ap ; <i8*> [#uses=1] %apv = load ptr, ptr %ap ; <ptr> [#uses=1]
%va0.upgrd.2 = bitcast i8** %aq to i8* ; <i8*> [#uses=1] call void @llvm.va_copy( ptr %aq, ptr %apv )
%va1.upgrd.3 = bitcast i8* %apv to i8* ; <i8*> [#uses=1] call void @llvm.va_end( ptr %aq )
call void @llvm.va_copy( i8* %va0.upgrd.2, i8* %va1.upgrd.3 )
%va.upgrd.4 = bitcast i8** %aq to i8* ; <i8*> [#uses=1]
call void @llvm.va_end( i8* %va.upgrd.4 )
; Stop processing of arguments. ; Stop processing of arguments.
%va.upgrd.5 = bitcast i8** %ap to i8* ; <i8*> [#uses=1] call void @llvm.va_end( ptr %ap )
call void @llvm.va_end( i8* %va.upgrd.5 )
ret i32 %tmp ret i32 %tmp
} }

View File

@ -5,25 +5,25 @@
; RUN: grep 'i32 9' %t | count 1 ; RUN: grep 'i32 9' %t | count 1
%0 = type { i32, i32 } ; type %0 %0 = type { i32, i32 } ; type %0
@a = weak constant i32 undef ; <i32*> [#uses=1] @a = weak constant i32 undef ; <ptr> [#uses=1]
@b = weak constant i32 5 ; <i32*> [#uses=1] @b = weak constant i32 5 ; <ptr> [#uses=1]
@c = weak constant %0 { i32 7, i32 9 } ; <%0*> [#uses=1] @c = weak constant %0 { i32 7, i32 9 } ; <ptr> [#uses=1]
define i32 @la() { define i32 @la() {
%v = load i32, i32* @a ; <i32> [#uses=1] %v = load i32, ptr @a ; <i32> [#uses=1]
ret i32 %v ret i32 %v
} }
define i32 @lb() { define i32 @lb() {
%v = load i32, i32* @b ; <i32> [#uses=1] %v = load i32, ptr @b ; <i32> [#uses=1]
ret i32 %v ret i32 %v
} }
define i32 @lc() { define i32 @lc() {
%g = getelementptr %0, %0* @c, i32 0, i32 0 ; <i32*> [#uses=1] %g = getelementptr %0, ptr @c, i32 0, i32 0 ; <ptr> [#uses=1]
%u = load i32, i32* %g ; <i32> [#uses=1] %u = load i32, ptr %g ; <i32> [#uses=1]
%h = getelementptr %0, %0* @c, i32 0, i32 1 ; <i32*> [#uses=1] %h = getelementptr %0, ptr @c, i32 0, i32 1 ; <ptr> [#uses=1]
%v = load i32, i32* %h ; <i32> [#uses=1] %v = load i32, ptr %h ; <i32> [#uses=1]
%r = add i32 %u, %v %r = add i32 %u, %v
ret i32 %r ret i32 %r
} }

View File

@ -4,23 +4,23 @@
; ModuleID = '<stdin>' ; ModuleID = '<stdin>'
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
target triple = "i686-apple-darwin8" target triple = "i686-apple-darwin8"
@ld = external global x86_fp80 ; <x86_fp80*> [#uses=1] @ld = external global x86_fp80 ; <ptr> [#uses=1]
@d = global double 4.050000e+00, align 8 ; <double*> [#uses=1] @d = global double 4.050000e+00, align 8 ; <ptr> [#uses=1]
@f = global float 0x4010333340000000 ; <float*> [#uses=1] @f = global float 0x4010333340000000 ; <ptr> [#uses=1]
define i32 @foo() { define i32 @foo() {
entry: entry:
%retval = alloca i32, align 4 ; <i32*> [#uses=1] %retval = alloca i32, align 4 ; <ptr> [#uses=1]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%tmp = load float, float* @f ; <float> [#uses=1] %tmp = load float, ptr @f ; <float> [#uses=1]
%tmp1 = fpext float %tmp to double ; <double> [#uses=1] %tmp1 = fpext float %tmp to double ; <double> [#uses=1]
%tmp2 = load double, double* @d ; <double> [#uses=1] %tmp2 = load double, ptr @d ; <double> [#uses=1]
%tmp3 = fmul double %tmp1, %tmp2 ; <double> [#uses=1] %tmp3 = fmul double %tmp1, %tmp2 ; <double> [#uses=1]
%tmp4 = fpext double %tmp3 to x86_fp80 ; <x86_fp80> [#uses=1] %tmp4 = fpext double %tmp3 to x86_fp80 ; <x86_fp80> [#uses=1]
store x86_fp80 %tmp4, x86_fp80* @ld store x86_fp80 %tmp4, ptr @ld
br label %return br label %return
return: ; preds = %entry return: ; preds = %entry
%retval4 = load i32, i32* %retval ; <i32> [#uses=1] %retval4 = load i32, ptr %retval ; <i32> [#uses=1]
ret i32 %retval4 ret i32 %retval4
} }