2010-11-30 04:36:52 +08:00
|
|
|
; RUN: opt < %s -constprop -S | FileCheck %s
|
|
|
|
|
|
|
|
%struct = type { i32, [4 x i8] }
|
|
|
|
|
|
|
|
define i32 @test1() {
|
|
|
|
%A = extractvalue %struct { i32 2, [4 x i8] c"foo\00" }, 0
|
|
|
|
ret i32 %A
|
|
|
|
; CHECK: @test1
|
|
|
|
; CHECK: ret i32 2
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8 @test2() {
|
|
|
|
%A = extractvalue %struct { i32 2, [4 x i8] c"foo\00" }, 1, 2
|
|
|
|
ret i8 %A
|
|
|
|
; CHECK: @test2
|
|
|
|
; CHECK: ret i8 111
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test3() {
|
Land the long talked about "type system rewrite" patch. This
patch brings numerous advantages to LLVM. One way to look at it
is through diffstat:
109 files changed, 3005 insertions(+), 5906 deletions(-)
Removing almost 3K lines of code is a good thing. Other advantages
include:
1. Value::getType() is a simple load that can be CSE'd, not a mutating
union-find operation.
2. Types a uniqued and never move once created, defining away PATypeHolder.
3. Structs can be "named" now, and their name is part of the identity that
uniques them. This means that the compiler doesn't merge them structurally
which makes the IR much less confusing.
4. Now that there is no way to get a cycle in a type graph without a named
struct type, "upreferences" go away.
5. Type refinement is completely gone, which should make LTO much MUCH faster
in some common cases with C++ code.
6. Types are now generally immutable, so we can use "Type *" instead
"const Type *" everywhere.
Downsides of this patch are that it removes some functions from the C API,
so people using those will have to upgrade to (not yet added) new API.
"LLVM 3.0" is the right time to do this.
There are still some cleanups pending after this, this patch is large enough
as-is.
llvm-svn: 134829
2011-07-10 01:41:24 +08:00
|
|
|
%A = extractvalue [3 x %struct] [ %struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" } ], 1, 0
|
2010-11-30 04:36:52 +08:00
|
|
|
ret i32 %A
|
|
|
|
; CHECK: @test3
|
|
|
|
; CHECK: ret i32 1
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @zeroinitializer-test1() {
|
|
|
|
%A = extractvalue %struct zeroinitializer, 0
|
|
|
|
ret i32 %A
|
|
|
|
; CHECK: @zeroinitializer-test1
|
|
|
|
; CHECK: ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8 @zeroinitializer-test2() {
|
|
|
|
%A = extractvalue %struct zeroinitializer, 1, 2
|
|
|
|
ret i8 %A
|
|
|
|
; CHECK: @zeroinitializer-test2
|
|
|
|
; CHECK: ret i8 0
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @zeroinitializer-test3() {
|
Land the long talked about "type system rewrite" patch. This
patch brings numerous advantages to LLVM. One way to look at it
is through diffstat:
109 files changed, 3005 insertions(+), 5906 deletions(-)
Removing almost 3K lines of code is a good thing. Other advantages
include:
1. Value::getType() is a simple load that can be CSE'd, not a mutating
union-find operation.
2. Types a uniqued and never move once created, defining away PATypeHolder.
3. Structs can be "named" now, and their name is part of the identity that
uniques them. This means that the compiler doesn't merge them structurally
which makes the IR much less confusing.
4. Now that there is no way to get a cycle in a type graph without a named
struct type, "upreferences" go away.
5. Type refinement is completely gone, which should make LTO much MUCH faster
in some common cases with C++ code.
6. Types are now generally immutable, so we can use "Type *" instead
"const Type *" everywhere.
Downsides of this patch are that it removes some functions from the C API,
so people using those will have to upgrade to (not yet added) new API.
"LLVM 3.0" is the right time to do this.
There are still some cleanups pending after this, this patch is large enough
as-is.
llvm-svn: 134829
2011-07-10 01:41:24 +08:00
|
|
|
%A = extractvalue [3 x %struct] zeroinitializer, 1, 0
|
2010-11-30 04:36:52 +08:00
|
|
|
ret i32 %A
|
|
|
|
; CHECK: @zeroinitializer-test3
|
|
|
|
; CHECK: ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @undef-test1() {
|
|
|
|
%A = extractvalue %struct undef, 0
|
|
|
|
ret i32 %A
|
|
|
|
; CHECK: @undef-test1
|
|
|
|
; CHECK: ret i32 undef
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8 @undef-test2() {
|
|
|
|
%A = extractvalue %struct undef, 1, 2
|
|
|
|
ret i8 %A
|
|
|
|
; CHECK: @undef-test2
|
|
|
|
; CHECK: ret i8 undef
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @undef-test3() {
|
Land the long talked about "type system rewrite" patch. This
patch brings numerous advantages to LLVM. One way to look at it
is through diffstat:
109 files changed, 3005 insertions(+), 5906 deletions(-)
Removing almost 3K lines of code is a good thing. Other advantages
include:
1. Value::getType() is a simple load that can be CSE'd, not a mutating
union-find operation.
2. Types a uniqued and never move once created, defining away PATypeHolder.
3. Structs can be "named" now, and their name is part of the identity that
uniques them. This means that the compiler doesn't merge them structurally
which makes the IR much less confusing.
4. Now that there is no way to get a cycle in a type graph without a named
struct type, "upreferences" go away.
5. Type refinement is completely gone, which should make LTO much MUCH faster
in some common cases with C++ code.
6. Types are now generally immutable, so we can use "Type *" instead
"const Type *" everywhere.
Downsides of this patch are that it removes some functions from the C API,
so people using those will have to upgrade to (not yet added) new API.
"LLVM 3.0" is the right time to do this.
There are still some cleanups pending after this, this patch is large enough
as-is.
llvm-svn: 134829
2011-07-10 01:41:24 +08:00
|
|
|
%A = extractvalue [3 x %struct] undef, 1, 0
|
2010-11-30 04:36:52 +08:00
|
|
|
ret i32 %A
|
|
|
|
; CHECK: @undef-test3
|
|
|
|
; CHECK: ret i32 undef
|
|
|
|
}
|
|
|
|
|