Remove llvm-upgrade and update test cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47793 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Tanya Lattner 2008-03-01 09:15:35 +00:00
parent ab3b77834c
commit ec9a35a6f9
258 changed files with 7470 additions and 7353 deletions

View File

@ -1,13 +1,16 @@
; It is illegal to remove BB1 because it will mess up the PHI node!
;
; RUN: llvm-upgrade < %s | llvm-as | opt -adce | llvm-dis | grep BB1
; RUN: llvm-as < %s | opt -adce | llvm-dis | grep BB1
define i32 @test(i1 %C, i32 %A, i32 %B) {
; <label>:0
br i1 %C, label %BB1, label %BB2
int "test"(bool %C, int %A, int %B) {
br bool %C, label %BB1, label %BB2
BB1:
br label %BB2
BB2:
%R = phi int [%A, %0], [%B, %BB1]
ret int %R
BB1: ; preds = %0
br label %BB2
BB2: ; preds = %BB1, %0
%R = phi i32 [ %A, %0 ], [ %B, %BB1 ] ; <i32> [#uses=1]
ret i32 %R
}

View File

@ -4,30 +4,29 @@
; removed even though there were uses still around. Now the uses are filled
; in with a dummy value before the PHI is deleted.
;
; RUN: llvm-upgrade < %s | llvm-as | opt -adce
; RUN: llvm-as < %s | opt -adce
%node_t = type { double*, %node_t*, %node_t**, double**, double*, int, int }
%node_t = type { double*, %node_t*, %node_t**, double**, double*, i32, i32 }
implementation ; Functions:
define void @localize_local(%node_t* %nodelist) {
bb0:
%nodelist.upgrd.1 = alloca %node_t* ; <%node_t**> [#uses=2]
store %node_t* %nodelist, %node_t** %nodelist.upgrd.1
br label %bb1
void %localize_local(%node_t* %nodelist) {
bb0: ;[#uses=0]
%nodelist = alloca %node_t* ; <%node_t**> [#uses=2]
store %node_t* %nodelist, %node_t** %nodelist
br label %bb1
bb1: ; preds = %bb0
%reg107 = load %node_t** %nodelist.upgrd.1 ; <%node_t*> [#uses=2]
%cond211 = icmp eq %node_t* %reg107, null ; <i1> [#uses=1]
br i1 %cond211, label %bb3, label %bb2
bb1: ;[#uses=2]
%reg107 = load %node_t** %nodelist ; <%node_t*> [#uses=2]
%cond211 = seteq %node_t* %reg107, null ; <bool> [#uses=1]
br bool %cond211, label %bb3, label %bb2
bb2: ; preds = %bb2, %bb1
%reg109 = phi %node_t* [ %reg110, %bb2 ], [ %reg107, %bb1 ] ; <%node_t*> [#uses=1]
%reg212 = getelementptr %node_t* %reg109, i64 0, i32 1 ; <%node_t**> [#uses=1]
%reg110 = load %node_t** %reg212 ; <%node_t*> [#uses=2]
%cond213 = icmp ne %node_t* %reg110, null ; <i1> [#uses=1]
br i1 %cond213, label %bb2, label %bb3
bb2: ;[#uses=3]
%reg109 = phi %node_t* [ %reg110, %bb2 ], [ %reg107, %bb1 ] ; <%node_t*> [#uses=1]
%reg212 = getelementptr %node_t* %reg109, long 0, uint 1 ; <%node_t**> [#uses=1]
%reg110 = load %node_t** %reg212 ; <%node_t*> [#uses=2]
%cond213 = setne %node_t* %reg110, null ; <bool> [#uses=1]
br bool %cond213, label %bb2, label %bb3
bb3: ;[#uses=2]
ret void
bb3: ; preds = %bb2, %bb1
ret void
}

View File

@ -1,17 +1,17 @@
; This testcase is a distilled form of: 2002-05-28-Crash.ll
; RUN: llvm-upgrade < %s | llvm-as | opt -adce
; RUN: llvm-as < %s | opt -adce
float "test"(int %i) {
%F = cast int %i to float ; This BB is not dead
%I = cast int %i to uint ; future dead inst
br label %Loop
define float @test(i32 %i) {
%F = sitofp i32 %i to float ; <float> [#uses=1]
%I = bitcast i32 %i to i32 ; <i32> [#uses=1]
br label %Loop
Loop: ; This block is dead
%B = cast uint %I to bool
br bool %B, label %Out, label %Loop
Loop: ; preds = %Loop, %0
%B = icmp ne i32 %I, 0 ; <i1> [#uses=1]
br i1 %B, label %Out, label %Loop
Out:
ret float %F
Out: ; preds = %Loop
ret float %F
}

View File

@ -11,46 +11,44 @@
; return !s;
;}
;
; RUN: llvm-upgrade < %s | llvm-as | opt -adce
; RUN: llvm-as < %s | opt -adce
implementation ; Functions:
define i32 @rx_bitset_empty(i32 %size, i32* %set) {
bb1:
%reg110 = load i32* %set ; <i32> [#uses=2]
store i32 1, i32* %set
%cast112 = sext i32 %size to i64 ; <i64> [#uses=1]
%reg113 = add i64 %cast112, 31 ; <i64> [#uses=1]
%reg114 = lshr i64 %reg113, 5 ; <i64> [#uses=2]
%cast109 = trunc i64 %reg114 to i32 ; <i32> [#uses=1]
%reg129 = add i32 %cast109, -1 ; <i32> [#uses=1]
%reg114-idxcast = trunc i64 %reg114 to i32 ; <i32> [#uses=1]
%reg114-idxcast-offset = add i32 %reg114-idxcast, 1073741823 ; <i32> [#uses=1]
%reg114-idxcast-offset.upgrd.1 = zext i32 %reg114-idxcast-offset to i64 ; <i64> [#uses=1]
%reg124 = getelementptr i32* %set, i64 %reg114-idxcast-offset.upgrd.1 ; <i32*> [#uses=1]
%reg125 = load i32* %reg124 ; <i32> [#uses=1]
%cond232 = icmp ne i32 %reg125, 0 ; <i1> [#uses=1]
br i1 %cond232, label %bb3, label %bb2
int %rx_bitset_empty(int %size, uint* %set) {
bb1: ;[#uses=2]
%reg110 = load uint* %set ; <uint> [#uses=2]
store uint 1, uint* %set
%cast112 = cast int %size to ulong ; <ulong> [#uses=1]
%reg113 = add ulong %cast112, 31 ; <ulong> [#uses=1]
%reg114 = shr ulong %reg113, ubyte 5 ; <ulong> [#uses=2]
%cast109 = cast ulong %reg114 to int ; <int> [#uses=1]
%reg129 = add int %cast109, -1 ; <int> [#uses=1]
%reg114-idxcast = cast ulong %reg114 to uint ; <uint> [#uses=1]
%reg114-idxcast-offset = add uint %reg114-idxcast, 1073741823 ; <uint> [#uses=1]
%reg114-idxcast-offset = cast uint %reg114-idxcast-offset to long
%reg124 = getelementptr uint* %set, long %reg114-idxcast-offset ; <uint*> [#uses=1]
%reg125 = load uint* %reg124 ; <uint> [#uses=1]
%cond232 = setne uint %reg125, 0 ; <bool> [#uses=1]
br bool %cond232, label %bb3, label %bb2
bb2: ;[#uses=3]
%cann-indvar = phi int [ 0, %bb1 ], [ %add1-indvar, %bb2 ] ; <int> [#uses=2]
%reg130-scale = mul int %cann-indvar, -1 ; <int> [#uses=1]
%reg130 = add int %reg130-scale, %reg129 ; <int> [#uses=1]
%add1-indvar = add int %cann-indvar, 1 ; <int> [#uses=1]
%reg130-idxcast = cast int %reg130 to uint ; <uint> [#uses=1]
%reg130-idxcast-offset = add uint %reg130-idxcast, 1073741823 ; <uint> [#uses=1]
%reg130-idxcast-offset = cast uint %reg130-idxcast-offset to long
%reg118 = getelementptr uint* %set, long %reg130-idxcast-offset ; <uint*> [#uses=1]
%reg119 = load uint* %reg118 ; <uint> [#uses=1]
%cond233 = seteq uint %reg119, 0 ; <bool> [#uses=1]
br bool %cond233, label %bb2, label %bb3
bb3: ;[#uses=2]
store uint %reg110, uint* %set
%cast126 = cast uint %reg110 to ulong ; <ulong> [#uses=1]
%reg127 = add ulong %cast126, 18446744073709551615 ; <ulong> [#uses=1]
%reg128 = shr ulong %reg127, ubyte 63 ; <ulong> [#uses=1]
%cast120 = cast ulong %reg128 to int ; <int> [#uses=1]
ret int %cast120
bb2: ; preds = %bb2, %bb1
%cann-indvar = phi i32 [ 0, %bb1 ], [ %add1-indvar, %bb2 ] ; <i32> [#uses=2]
%reg130-scale = mul i32 %cann-indvar, -1 ; <i32> [#uses=1]
%reg130 = add i32 %reg130-scale, %reg129 ; <i32> [#uses=1]
%add1-indvar = add i32 %cann-indvar, 1 ; <i32> [#uses=1]
%reg130-idxcast = bitcast i32 %reg130 to i32 ; <i32> [#uses=1]
%reg130-idxcast-offset = add i32 %reg130-idxcast, 1073741823 ; <i32> [#uses=1]
%reg130-idxcast-offset.upgrd.2 = zext i32 %reg130-idxcast-offset to i64 ; <i64> [#uses=1]
%reg118 = getelementptr i32* %set, i64 %reg130-idxcast-offset.upgrd.2 ; <i32*> [#uses=1]
%reg119 = load i32* %reg118 ; <i32> [#uses=1]
%cond233 = icmp eq i32 %reg119, 0 ; <i1> [#uses=1]
br i1 %cond233, label %bb2, label %bb3
bb3: ; preds = %bb2, %bb1
store i32 %reg110, i32* %set
%cast126 = zext i32 %reg110 to i64 ; <i64> [#uses=1]
%reg127 = add i64 %cast126, -1 ; <i64> [#uses=1]
%reg128 = lshr i64 %reg127, 63 ; <i64> [#uses=1]
%cast120 = trunc i64 %reg128 to i32 ; <i32> [#uses=1]
ret i32 %cast120
}

View File

@ -3,11 +3,11 @@
; block in this function, it would work fine, but that would be the part we
; have to fix now, wouldn't it....
;
; RUN: llvm-upgrade < %s | llvm-as | opt -adce
; RUN: llvm-as < %s | opt -adce
void %foo(sbyte* %reg5481) {
%cast611 = cast sbyte* %reg5481 to sbyte** ; <sbyte**> [#uses=1]
%reg162 = load sbyte** %cast611 ; <sbyte*> [#uses=0]
cast sbyte*%reg162 to int
ret void
define void @foo(i8* %reg5481) {
%cast611 = bitcast i8* %reg5481 to i8** ; <i8**> [#uses=1]
%reg162 = load i8** %cast611 ; <i8*> [#uses=1]
ptrtoint i8* %reg162 to i32 ; <i32>:1 [#uses=0]
ret void
}

View File

@ -1,49 +1,48 @@
; This testcase was extracted from the gzip SPEC benchmark
;
; RUN: llvm-upgrade < %s | llvm-as | opt -adce
; RUN: llvm-as < %s | opt -adce
%bk = external global uint ; <uint*> [#uses=2]
%hufts = external global uint ; <uint*> [#uses=1]
@bk = external global i32 ; <i32*> [#uses=2]
@hufts = external global i32 ; <i32*> [#uses=1]
implementation ; Functions:
define i32 @inflate() {
bb0:
br label %bb2
int %inflate() {
bb0: ;[#uses=1]
br label %bb2
bb2: ; preds = %bb6, %bb0
%reg128 = phi i32 [ %reg130, %bb6 ], [ 0, %bb0 ] ; <i32> [#uses=2]
br i1 true, label %bb4, label %bb3
bb2: ;[#uses=2]
%reg128 = phi uint [ %reg130, %bb6 ], [ 0, %bb0 ] ; <uint> [#uses=2]
br bool true, label %bb4, label %bb3
bb3: ; preds = %bb2
br label %UnifiedExitNode
bb3: ;[#uses=2]
br label %UnifiedExitNode
bb4: ; preds = %bb2
%reg117 = load i32* @hufts ; <i32> [#uses=2]
%cond241 = icmp ule i32 %reg117, %reg128 ; <i1> [#uses=1]
br i1 %cond241, label %bb6, label %bb5
bb4: ;[#uses=2]
%reg117 = load uint* %hufts ; <uint> [#uses=2]
%cond241 = setle uint %reg117, %reg128 ; <bool> [#uses=1]
br bool %cond241, label %bb6, label %bb5
bb5: ; preds = %bb4
br label %bb6
bb5: ;[#uses=2]
br label %bb6
bb6: ; preds = %bb5, %bb4
%reg130 = phi i32 [ %reg117, %bb5 ], [ %reg128, %bb4 ] ; <i32> [#uses=1]
br i1 false, label %bb2, label %bb7
bb6: ;[#uses=3]
%reg130 = phi uint [ %reg117, %bb5 ], [ %reg128, %bb4 ] ; <uint> [#uses=1]
br bool false, label %bb2, label %bb7
bb7: ; preds = %bb6
%reg126 = load i32* @bk ; <i32> [#uses=1]
%cond247 = icmp ule i32 %reg126, 7 ; <i1> [#uses=1]
br i1 %cond247, label %bb9, label %bb8
bb7: ;[#uses=1]
%reg126 = load uint* %bk ; <uint> [#uses=1]
%cond247 = setle uint %reg126, 7 ; <bool> [#uses=1]
br bool %cond247, label %bb9, label %bb8
bb8: ; preds = %bb8, %bb7
%reg119 = load i32* @bk ; <i32> [#uses=1]
%cond256 = icmp ugt i32 %reg119, 7 ; <i1> [#uses=1]
br i1 %cond256, label %bb8, label %bb9
bb8: ;[#uses=2]
%reg119 = load uint* %bk ; <uint> [#uses=1]
%cond256 = setgt uint %reg119, 7 ; <bool> [#uses=1]
br bool %cond256, label %bb8, label %bb9
bb9: ; preds = %bb8, %bb7
br label %UnifiedExitNode
bb9: ;[#uses=3]
br label %UnifiedExitNode
UnifiedExitNode: ;[#uses=2]
%UnifiedRetVal = phi int [ 7, %bb3 ], [ 0, %bb9 ] ; <int> [#uses=1]
ret int %UnifiedRetVal
UnifiedExitNode: ; preds = %bb9, %bb3
%UnifiedRetVal = phi i32 [ 7, %bb3 ], [ 0, %bb9 ] ; <i32> [#uses=1]
ret i32 %UnifiedRetVal
}

View File

@ -1,9 +1,9 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce
; RUN: llvm-as < %s | opt -adce
void "test"()
begin
br label %BB3
define void @test() {
br label %BB3
BB3: ; preds = %BB3, %0
br label %BB3
}
BB3:
br label %BB3
end

View File

@ -1,25 +1,25 @@
; Testcase reduced from 197.parser by bugpoint
; RUN: llvm-upgrade < %s | llvm-as | opt -adce
implementation ; Functions:
; RUN: llvm-as < %s | opt -adce
void %conjunction_prune() {
; <label>:0 ; No predecessors!
br label %bb19
define void @conjunction_prune() {
; <label>:0
br label %bb19
bb19: ; preds = %bb22, %bb23, %0
%reg205 = phi sbyte* [ null, %bb22 ], [ null, %bb23 ], [ null, %0 ] ; <sbyte*> [#uses=1]
br bool false, label %bb21, label %bb22
bb19: ; preds = %bb23, %bb22, %0
%reg205 = phi i8* [ null, %bb22 ], [ null, %bb23 ], [ null, %0 ] ; <i8*> [#uses=1]
br i1 false, label %bb21, label %bb22
bb21: ; preds = %bb19
%cast455 = cast sbyte* %reg205 to sbyte** ; <sbyte**> [#uses=0]
br label %bb22
bb21: ; preds = %bb19
%cast455 = bitcast i8* %reg205 to i8** ; <i8**> [#uses=0]
br label %bb22
bb22: ; preds = %bb21, %bb19
br bool false, label %bb19, label %bb23
bb22: ; preds = %bb21, %bb19
br i1 false, label %bb19, label %bb23
bb23: ; preds = %bb22
br bool false, label %bb19, label %bb28
bb23: ; preds = %bb22
br i1 false, label %bb19, label %bb28
bb28: ; preds = %bb23
ret void
bb28: ; preds = %bb23
ret void
}

View File

@ -2,36 +2,34 @@
; entries for it's postdominator. But I think this can only happen when the
; PHI node is dead, so we just avoid patching up dead PHI nodes.
; RUN: llvm-upgrade < %s | llvm-as | opt -adce
; RUN: llvm-as < %s | opt -adce
target endian = little
target pointersize = 32
target datalayout = "e-p:32:32"
implementation ; Functions:
define void @dead_test8() {
entry:
br label %loopentry
void %dead_test8() {
entry: ; No predecessors!
br label %loopentry
loopentry: ; preds = %endif, %entry
%k.1 = phi i32 [ %k.0, %endif ], [ 0, %entry ] ; <i32> [#uses=1]
br i1 false, label %no_exit, label %return
loopentry: ; preds = %entry, %endif
%k.1 = phi int [ %k.0, %endif ], [ 0, %entry ] ; <int> [#uses=1]
br bool false, label %no_exit, label %return
no_exit: ; preds = %loopentry
br i1 false, label %then, label %else
no_exit: ; preds = %loopentry
br bool false, label %then, label %else
then: ; preds = %no_exit
br label %endif
then: ; preds = %no_exit
br label %endif
else: ; preds = %no_exit
%dec = add i32 %k.1, -1 ; <i32> [#uses=1]
br label %endif
else: ; preds = %no_exit
%dec = add int %k.1, -1 ; <int> [#uses=1]
br label %endif
endif: ; preds = %else, %then
%k.0 = phi i32 [ %dec, %else ], [ 0, %then ] ; <i32> [#uses=1]
store i32 2, i32* null
br label %loopentry
endif: ; preds = %else, %then
%k.0 = phi int [ %dec, %else ], [ 0, %then ] ; <int> [#uses=1]
store int 2, int* null
br label %loopentry
return: ; preds = %loopentry
ret void
return: ; preds = %loopentry
ret void
}

View File

@ -1,28 +1,28 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce -disable-output
%G = external global int*
; RUN: llvm-as < %s | opt -adce -disable-output
implementation ; Functions:
@G = external global i32* ; <i32**> [#uses=1]
declare void %Fn(int*)
declare void @Fn(i32*)
int %main(int %argc.1, sbyte** %argv.1) {
entry: ; No predecessors!
br label %endif.42
define i32 @main(i32 %argc.1, i8** %argv.1) {
entry:
br label %endif.42
endif.42: ; preds = %entry, %shortcirc_done.12, %then.66, %endif.42
br bool false, label %endif.65, label %endif.42
then.66: ; preds = %shortcirc_done.12
call void %Fn( int* %tmp.2846)
br label %endif.42
endif.42: ; preds = %shortcirc_done.12, %then.66, %endif.42, %entry
br i1 false, label %endif.65, label %endif.42
endif.65: ; preds = %endif.42
%tmp.2846 = load int** %G
br bool false, label %shortcirc_next.12, label %shortcirc_done.12
then.66: ; preds = %shortcirc_done.12
call void @Fn( i32* %tmp.2846 )
br label %endif.42
shortcirc_next.12: ; preds = %endif.65
br label %shortcirc_done.12
endif.65: ; preds = %endif.42
%tmp.2846 = load i32** @G ; <i32*> [#uses=1]
br i1 false, label %shortcirc_next.12, label %shortcirc_done.12
shortcirc_done.12: ; preds = %endif.65, %shortcirc_next.12
br bool false, label %then.66, label %endif.42
shortcirc_next.12: ; preds = %endif.65
br label %shortcirc_done.12
shortcirc_done.12: ; preds = %shortcirc_next.12, %endif.65
br i1 false, label %then.66, label %endif.42
}

View File

@ -1,94 +1,91 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce -disable-output
; RUN: llvm-as < %s | opt -adce -disable-output
target datalayout = "e-p:32:32"
%struct..CppObjTypeDesc = type { i32, i16, i16 }
%struct..TypeToken = type { i32, i16, i16 }
target endian = little
target pointersize = 32
%struct..CppObjTypeDesc = type { uint, ushort, ushort }
%struct..TypeToken = type { uint, ushort, ushort }
implementation ; Functions:
uint %C_ReFaxToDb() {
entry: ; No predecessors!
br bool false, label %endif.0, label %then.0
define i32 @C_ReFaxToDb() {
entry:
br i1 false, label %endif.0, label %then.0
then.0: ; preds = %entry
ret uint 0
ret i32 0
endif.0: ; preds = %entry
br bool false, label %then.11, label %then.4
br i1 false, label %then.11, label %then.4
then.4: ; preds = %endif.0
ret uint 0
ret i32 0
then.11: ; preds = %endif.0
br bool false, label %loopentry.0, label %else.2
br i1 false, label %loopentry.0, label %else.2
loopentry.0: ; preds = %then.11, %endif.14, %loopentry.1
br bool false, label %endif.14, label %loopexit.0
loopentry.0: ; preds = %loopentry.1, %endif.14, %then.11
br i1 false, label %endif.14, label %loopexit.0
endif.14: ; preds = %loopentry.0
br bool false, label %loopentry.1, label %loopentry.0
br i1 false, label %loopentry.1, label %loopentry.0
loopentry.1: ; preds = %endif.14, %then.53, %then.53, %then.53, %then.53, %then.53
%SubArrays.10 = phi uint* [ %SubArrays.8, %then.53 ] , [ null, %endif.14 ] ; <uint*> [#uses=3]
br bool false, label %no_exit.1, label %loopentry.0
loopentry.1: ; preds = %then.53, %endif.14
%SubArrays.10 = phi i32* [ %SubArrays.8, %then.53 ], [ null, %endif.14 ] ; <i32*> [#uses=3]
br i1 false, label %no_exit.1, label %loopentry.0
no_exit.1: ; preds = %loopentry.1
switch uint 0, label %label.17 [
uint 2, label %label.11
uint 19, label %label.10
switch i32 0, label %label.17 [
i32 2, label %label.11
i32 19, label %label.10
]
label.10: ; preds = %no_exit.1
br bool false, label %then.43, label %endif.43
br i1 false, label %then.43, label %endif.43
then.43: ; preds = %label.10
br bool false, label %then.44, label %endif.44
br i1 false, label %then.44, label %endif.44
then.44: ; preds = %then.43
br bool false, label %shortcirc_next.4, label %endif.45
br i1 false, label %shortcirc_next.4, label %endif.45
shortcirc_next.4: ; preds = %then.44
br bool false, label %no_exit.2, label %loopexit.2
br i1 false, label %no_exit.2, label %loopexit.2
no_exit.2: ; preds = %shortcirc_next.4
%tmp.897 = getelementptr uint* %SubArrays.10, long 0 ; <uint*> [#uses=1]
%tmp.899 = load uint* %tmp.897 ; <uint> [#uses=1]
store uint %tmp.899, uint* null
ret uint 0
%tmp.897 = getelementptr i32* %SubArrays.10, i64 0 ; <i32*> [#uses=1]
%tmp.899 = load i32* %tmp.897 ; <i32> [#uses=1]
store i32 %tmp.899, i32* null
ret i32 0
loopexit.2: ; preds = %shortcirc_next.4
ret uint 0
ret i32 0
endif.45: ; preds = %then.44
ret uint 0
ret i32 0
endif.44: ; preds = %then.43
ret uint 0
ret i32 0
endif.43: ; preds = %label.10
ret uint 0
ret i32 0
label.11: ; preds = %no_exit.1
ret uint 0
ret i32 0
label.17: ; preds = %no_exit.1, %no_exit.1, %no_exit.1, %no_exit.1, %no_exit.1, %no_exit.1
br bool false, label %then.53, label %shortcirc_next.7
label.17: ; preds = %no_exit.1
br i1 false, label %then.53, label %shortcirc_next.7
shortcirc_next.7: ; preds = %label.17
br bool false, label %then.53, label %shortcirc_next.8
br i1 false, label %then.53, label %shortcirc_next.8
shortcirc_next.8: ; preds = %shortcirc_next.7
ret uint 0
ret i32 0
then.53: ; preds = %shortcirc_next.7, %label.17
%SubArrays.8 = phi uint* [ %SubArrays.10, %shortcirc_next.7 ], [ %SubArrays.10, %label.17 ] ; <uint*> [#uses=5]
%tmp.1023 = load uint* null ; <uint> [#uses=1]
switch uint %tmp.1023, label %loopentry.1 []
%SubArrays.8 = phi i32* [ %SubArrays.10, %shortcirc_next.7 ], [ %SubArrays.10, %label.17 ] ; <i32*> [#uses=1]
%tmp.1023 = load i32* null ; <i32> [#uses=1]
switch i32 %tmp.1023, label %loopentry.1 [
]
loopexit.0: ; preds = %loopentry.0
ret uint 0
ret i32 0
else.2: ; preds = %then.11
ret uint 0
ret i32 0
}

View File

@ -1,40 +1,41 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce -simplifycfg | llvm-dis | not grep then:
; RUN: llvm-as < %s | opt -adce -simplifycfg | llvm-dis | not grep then:
void %dead_test8(int* %data.1, int %idx.1) {
entry: ; No predecessors!
%tmp.1 = load int* %data.1 ; <int> [#uses=2]
%tmp.41 = setgt int %tmp.1, 0 ; <bool> [#uses=1]
br bool %tmp.41, label %no_exit.preheader, label %return
define void @dead_test8(i32* %data.1, i32 %idx.1) {
entry:
%tmp.1 = load i32* %data.1 ; <i32> [#uses=2]
%tmp.41 = icmp sgt i32 %tmp.1, 0 ; <i1> [#uses=1]
br i1 %tmp.41, label %no_exit.preheader, label %return
no_exit.preheader: ; preds = %entry
%tmp.11 = getelementptr int* %data.1, long 1 ; <int*> [#uses=1]
%tmp.22-idxcast = cast int %idx.1 to long ; <long> [#uses=1]
%tmp.28 = getelementptr int* %data.1, long %tmp.22-idxcast ; <int*> [#uses=1]
br label %no_exit
no_exit.preheader: ; preds = %entry
%tmp.11 = getelementptr i32* %data.1, i64 1 ; <i32*> [#uses=1]
%tmp.22-idxcast = sext i32 %idx.1 to i64 ; <i64> [#uses=1]
%tmp.28 = getelementptr i32* %data.1, i64 %tmp.22-idxcast ; <i32*> [#uses=1]
br label %no_exit
no_exit: ; preds = %no_exit.preheader, %endif
%k.1 = phi int [ %k.0, %endif ], [ 0, %no_exit.preheader ] ; <int> [#uses=3]
%i.0 = phi int [ %inc.1, %endif ], [ 0, %no_exit.preheader ] ; <int> [#uses=1]
%tmp.12 = load int* %tmp.11 ; <int> [#uses=1]
%tmp.14 = sub int 0, %tmp.12 ; <int> [#uses=1]
%tmp.161 = setne int %k.1, %tmp.14 ; <bool> [#uses=1]
br bool %tmp.161, label %then, label %else
no_exit: ; preds = %endif, %no_exit.preheader
%k.1 = phi i32 [ %k.0, %endif ], [ 0, %no_exit.preheader ] ; <i32> [#uses=3]
%i.0 = phi i32 [ %inc.1, %endif ], [ 0, %no_exit.preheader ] ; <i32> [#uses=1]
%tmp.12 = load i32* %tmp.11 ; <i32> [#uses=1]
%tmp.14 = sub i32 0, %tmp.12 ; <i32> [#uses=1]
%tmp.161 = icmp ne i32 %k.1, %tmp.14 ; <i1> [#uses=1]
br i1 %tmp.161, label %then, label %else
then: ; preds = %no_exit
%inc.0 = add int %k.1, 1 ; <int> [#uses=1]
br label %endif
then: ; preds = %no_exit
%inc.0 = add i32 %k.1, 1 ; <i32> [#uses=1]
br label %endif
else: ; preds = %no_exit
%dec = add int %k.1, -1 ; <int> [#uses=1]
br label %endif
else: ; preds = %no_exit
%dec = add i32 %k.1, -1 ; <i32> [#uses=1]
br label %endif
endif: ; preds = %else, %then
%k.0 = phi int [ %dec, %else ], [ %inc.0, %then ] ; <int> [#uses=1]
store int 2, int* %tmp.28
%inc.1 = add int %i.0, 1 ; <int> [#uses=2]
%tmp.4 = setlt int %inc.1, %tmp.1 ; <bool> [#uses=1]
br bool %tmp.4, label %no_exit, label %return
endif: ; preds = %else, %then
%k.0 = phi i32 [ %dec, %else ], [ %inc.0, %then ] ; <i32> [#uses=1]
store i32 2, i32* %tmp.28
%inc.1 = add i32 %i.0, 1 ; <i32> [#uses=2]
%tmp.4 = icmp slt i32 %inc.1, %tmp.1 ; <i1> [#uses=1]
br i1 %tmp.4, label %no_exit, label %return
return: ; preds = %entry, %endif
ret void
return: ; preds = %endif, %entry
ret void
}

View File

@ -1,20 +1,19 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce -disable-output
; RUN: llvm-as < %s | opt -adce -disable-output
implementation ; Functions:
define void @test() {
br i1 false, label %then, label %endif
void %test() {
br bool false, label %then, label %endif
then: ; preds = %0
invoke void null( i8* null )
to label %invoke_cont unwind label %invoke_catch
then:
invoke void null( sbyte* null )
to label %invoke_cont except label %invoke_catch
invoke_catch: ; preds = %then
unwind
invoke_catch:
unwind
invoke_cont: ; preds = %then
ret void
invoke_cont:
ret void
endif:
ret void
endif: ; preds = %0
ret void
}

View File

@ -1,8 +1,9 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce -disable-output
; RUN: llvm-as < %s | opt -adce -disable-output
int %main() {
br label %loop
define i32 @main() {
br label %loop
loop:
br label %loop
loop: ; preds = %loop, %0
br label %loop
}

View File

@ -1,17 +1,18 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce -simplifycfg | llvm-dis | grep call
declare void %exit(int)
; RUN: llvm-as < %s | opt -adce -simplifycfg | llvm-dis | grep call
declare void @exit(i32)
int %main(int %argc) {
%C = seteq int %argc, 1
br bool %C, label %Cond, label %Done
define i32 @main(i32 %argc) {
%C = icmp eq i32 %argc, 1 ; <i1> [#uses=2]
br i1 %C, label %Cond, label %Done
Cond:
br bool %C, label %Loop, label %Done
Cond: ; preds = %0
br i1 %C, label %Loop, label %Done
Loop:
call void %exit(int 0)
br label %Loop
Loop: ; preds = %Loop, %Cond
call void @exit( i32 0 )
br label %Loop
Done:
ret int 1
Done: ; preds = %Cond, %0
ret i32 1
}

View File

@ -1,28 +1,27 @@
; This testcase was failing because without merging the return blocks, ADCE
; didn't know that it could get rid of the then.0 block.
; RUN: llvm-upgrade < %s | llvm-as | opt -adce | llvm-dis | not grep load
; RUN: llvm-as < %s | opt -adce | llvm-dis | not grep load
implementation ; Functions:
void %main(uint %argc, sbyte** %argv) {
define void @main(i32 %argc, i8** %argv) {
entry:
call void %__main( )
%tmp.1 = setle uint %argc, 5 ; <bool> [#uses=1]
br bool %tmp.1, label %then.0, label %return
call void @__main( )
%tmp.1 = icmp ule i32 %argc, 5 ; <i1> [#uses=1]
br i1 %tmp.1, label %then.0, label %return
then.0: ; preds = %entry
%tmp.8 = load sbyte** %argv ; <sbyte*> [#uses=1]
%tmp.10 = load sbyte* %tmp.8 ; <sbyte> [#uses=1]
%tmp.11 = seteq sbyte %tmp.10, 98 ; <bool> [#uses=1]
br bool %tmp.11, label %then.1, label %return
then.0: ; preds = %entry
%tmp.8 = load i8** %argv ; <i8*> [#uses=1]
%tmp.10 = load i8* %tmp.8 ; <i8> [#uses=1]
%tmp.11 = icmp eq i8 %tmp.10, 98 ; <i1> [#uses=1]
br i1 %tmp.11, label %then.1, label %return
then.1: ; preds = %then.0
ret void
then.1: ; preds = %then.0
ret void
return: ; preds = %entry, %then.0
ret void
return: ; preds = %then.0, %entry
ret void
}
declare void %__main()
declare void @__main()

View File

@ -1,16 +1,16 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce -disable-output
; RUN: llvm-as < %s | opt -adce -disable-output
void %test() {
define void @test() {
entry:
br label %UnifiedReturnBlock
br label %UnifiedReturnBlock
UnifiedReturnBlock:
ret void
UnifiedReturnBlock: ; preds = %invoke_catch.0, %entry
ret void
invoke_catch.0: ; No predecessors!
br bool false, label %UnifiedUnwindBlock, label %UnifiedReturnBlock
UnifiedUnwindBlock: ; preds = %invoke_catch.0
unwind
invoke_catch.0: ; No predecessors!
br i1 false, label %UnifiedUnwindBlock, label %UnifiedReturnBlock
UnifiedUnwindBlock: ; preds = %invoke_catch.0
unwind
}

View File

@ -1,44 +1,45 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce -disable-output
; RUN: llvm-as < %s | opt -adce -disable-output
implementation ; Functions:
declare void @strlen()
declare void %strlen()
declare void %_ZN10QByteArray6resizeEi()
declare void %q_atomic_decrement()
declare void @_ZN10QByteArray6resizeEi()
void %_ZNK10QByteArray13leftJustifiedEicb() {
declare void @q_atomic_decrement()
define void @_ZNK10QByteArray13leftJustifiedEicb() {
entry:
invoke void %strlen( )
to label %tmp.3.i.noexc unwind label %invoke_catch.0
invoke void @strlen( )
to label %tmp.3.i.noexc unwind label %invoke_catch.0
tmp.3.i.noexc: ; preds = %entry
br bool false, label %then.0, label %else.0
tmp.3.i.noexc: ; preds = %entry
br i1 false, label %then.0, label %else.0
invoke_catch.0: ; preds = %entry
invoke void %q_atomic_decrement( )
to label %tmp.1.i.i183.noexc unwind label %terminate
invoke_catch.0: ; preds = %entry
invoke void @q_atomic_decrement( )
to label %tmp.1.i.i183.noexc unwind label %terminate
tmp.1.i.i183.noexc: ; preds = %invoke_catch.0
unwind
tmp.1.i.i183.noexc: ; preds = %invoke_catch.0
unwind
then.0: ; preds = %tmp.3.i.noexc
invoke void %_ZN10QByteArray6resizeEi( )
to label %invoke_cont.1 unwind label %invoke_catch.1
then.0: ; preds = %tmp.3.i.noexc
invoke void @_ZN10QByteArray6resizeEi( )
to label %invoke_cont.1 unwind label %invoke_catch.1
invoke_catch.1: ; preds = %then.0
invoke void %q_atomic_decrement( )
to label %tmp.1.i.i162.noexc unwind label %terminate
invoke_catch.1: ; preds = %then.0
invoke void @q_atomic_decrement( )
to label %tmp.1.i.i162.noexc unwind label %terminate
tmp.1.i.i162.noexc: ; preds = %invoke_catch.1
ret void
tmp.1.i.i162.noexc: ; preds = %invoke_catch.1
ret void
invoke_cont.1: ; preds = %then.0
ret void
invoke_cont.1: ; preds = %then.0
ret void
else.0: ; preds = %tmp.3.i.noexc
ret void
else.0: ; preds = %tmp.3.i.noexc
ret void
terminate: ; preds = %invoke_catch.1, %invoke_catch.0
%dbg.0.1 = phi { }* [ null, %invoke_catch.1 ], [ null, %invoke_catch.0 ] ; <{ }*> [#uses=1]
unreachable
terminate: ; preds = %invoke_catch.1, %invoke_catch.0
%dbg.0.1 = phi { }* [ null, %invoke_catch.1 ], [ null, %invoke_catch.0 ] ; <{ }*> [#uses=0]
unreachable
}

View File

@ -1,34 +1,36 @@
; This is the test case taken from Appel's book that illustrates a hard case
; that SCCP gets right, and when followed by ADCE, is completely eliminated
;
; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -adce -simplifycfg | llvm-dis | not grep br
; RUN: llvm-as < %s | opt -sccp -adce -simplifycfg | llvm-dis | not grep br
int "test function"(int %i0, int %j0) {
define i32 @"test function"(i32 %i0, i32 %j0) {
BB1:
br label %BB2
BB2:
%j2 = phi int [%j4, %BB7], [1, %BB1]
%k2 = phi int [%k4, %BB7], [0, %BB1]
%kcond = setlt int %k2, 100
br bool %kcond, label %BB3, label %BB4
br label %BB2
BB3:
%jcond = setlt int %j2, 20
br bool %jcond, label %BB5, label %BB6
BB2: ; preds = %BB7, %BB1
%j2 = phi i32 [ %j4, %BB7 ], [ 1, %BB1 ] ; <i32> [#uses=2]
%k2 = phi i32 [ %k4, %BB7 ], [ 0, %BB1 ] ; <i32> [#uses=4]
%kcond = icmp slt i32 %k2, 100 ; <i1> [#uses=1]
br i1 %kcond, label %BB3, label %BB4
BB4:
ret int %j2
BB3: ; preds = %BB2
%jcond = icmp slt i32 %j2, 20 ; <i1> [#uses=1]
br i1 %jcond, label %BB5, label %BB6
BB5:
%k3 = add int %k2, 1
br label %BB7
BB4: ; preds = %BB2
ret i32 %j2
BB6:
%k5 = add int %k2, 1
br label %BB7
BB5: ; preds = %BB3
%k3 = add i32 %k2, 1 ; <i32> [#uses=1]
br label %BB7
BB7:
%j4 = phi int [1, %BB5], [%k2, %BB6]
%k4 = phi int [%k3, %BB5], [%k5, %BB6]
br label %BB2
BB6: ; preds = %BB3
%k5 = add i32 %k2, 1 ; <i32> [#uses=1]
br label %BB7
BB7: ; preds = %BB6, %BB5
%j4 = phi i32 [ 1, %BB5 ], [ %k2, %BB6 ] ; <i32> [#uses=1]
%k4 = phi i32 [ %k3, %BB5 ], [ %k5, %BB6 ] ; <i32> [#uses=1]
br label %BB2
}

View File

@ -1,14 +1,19 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce -simplifycfg | llvm-dis
; RUN: llvm-as < %s | opt -adce -simplifycfg | llvm-dis
int "Test"(int %A, int %B) {
define i32 @Test(i32 %A, i32 %B) {
BB1:
br label %BB4
BB2:
br label %BB3
BB3:
%ret = phi int [%X, %BB4], [%B, %BB2]
ret int %ret
BB4:
%X = phi int [%A, %BB1]
br label %BB3
br label %BB4
BB2: ; No predecessors!
br label %BB3
BB3: ; preds = %BB4, %BB2
%ret = phi i32 [ %X, %BB4 ], [ %B, %BB2 ] ; <i32> [#uses=1]
ret i32 %ret
BB4: ; preds = %BB1
%X = phi i32 [ %A, %BB1 ] ; <i32> [#uses=1]
br label %BB3
}

View File

@ -1,101 +1,97 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce -simplifycfg | llvm-dis
%FILE = type { int, ubyte*, ubyte*, ubyte, ubyte, uint, uint, uint }
%spec_fd_t = type { int, int, int, ubyte* }
%__iob = uninitialized global [20 x %FILE] ; <[20 x %FILE]*> [#uses=1]
%dbglvl = global int 4 ; <int*> [#uses=3]
%spec_fd = uninitialized global [3 x %spec_fd_t] ; <[3 x %spec_fd_t]*> [#uses=4]
%.LC9 = internal global [34 x sbyte] c"spec_read: fd=%d, > MAX_SPEC_FD!\0A\00" ; <[34 x sbyte]*> [#uses=1]
%.LC10 = internal global [4 x sbyte] c"EOF\00" ; <[4 x sbyte]*> [#uses=1]
%.LC11 = internal global [4 x sbyte] c"%d\0A\00" ; <[4 x sbyte]*> [#uses=1]
%.LC12 = internal global [17 x sbyte] c"spec_getc: %d = \00" ; <[17 x sbyte]*> [#uses=1]
; RUN: llvm-as < %s | opt -adce -simplifycfg | llvm-dis
%FILE = type { i32, i8*, i8*, i8, i8, i32, i32, i32 }
%spec_fd_t = type { i32, i32, i32, i8* }
@__iob = external global [20 x %FILE] ; <[20 x %FILE]*> [#uses=1]
@dbglvl = global i32 4 ; <i32*> [#uses=3]
@spec_fd = external global [3 x %spec_fd_t] ; <[3 x %spec_fd_t]*> [#uses=4]
@.LC9 = internal global [34 x i8] c"spec_read: fd=%d, > MAX_SPEC_FD!\0A\00" ; <[34 x i8]*> [#uses=1]
@.LC10 = internal global [4 x i8] c"EOF\00" ; <[4 x i8]*> [#uses=1]
@.LC11 = internal global [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
@.LC12 = internal global [17 x i8] c"spec_getc: %d = \00" ; <[17 x i8]*> [#uses=1]
implementation ; Functions:
declare i32 @fprintf(%FILE*, i8*, ...)
declare int "fprintf"(%FILE*, sbyte*, ...)
declare void @exit(i32)
declare void "exit"(int)
declare i32 @remove(i8*)
declare int "remove"(sbyte*)
declare i32 @fputc(i32, %FILE*)
declare int "fputc"(int, %FILE*)
declare i32 @fwrite(i8*, i32, i32, %FILE*)
declare uint "fwrite"(sbyte*, uint, uint, %FILE*)
declare void @perror(i8*)
declare void "perror"(sbyte*)
define i32 @spec_getc(i32 %fd) {
%reg109 = load i32* @dbglvl ; <i32> [#uses=1]
%cond266 = icmp sle i32 %reg109, 4 ; <i1> [#uses=1]
br i1 %cond266, label %bb3, label %bb2
int "spec_getc"(int %fd) {
; <label>:0 ;[#uses=0]
%reg109 = load int* %dbglvl ; <int> [#uses=1]
%cond266 = setle int %reg109, 4 ; <bool> [#uses=1]
br bool %cond266, label %bb3, label %bb2
bb2: ;[#uses=1]
%cast273 = getelementptr [17 x sbyte]* %.LC12, long 0, long 0 ; <sbyte*> [#uses=0]
bb2: ; preds = %0
%cast273 = getelementptr [17 x i8]* @.LC12, i64 0, i64 0 ; <i8*> [#uses=0]
br label %bb3
bb3: ;[#uses=2]
%cond267 = setle int %fd, 3 ; <bool> [#uses=1]
br bool %cond267, label %bb5, label %bb4
bb3: ; preds = %bb2, %0
%cond267 = icmp sle i32 %fd, 3 ; <i1> [#uses=1]
br i1 %cond267, label %bb5, label %bb4
bb4: ;[#uses=2]
%reg111 = getelementptr [20 x %FILE]* %__iob, long 0, long 1, uint 3 ; <ubyte*> [#uses=1]
%cast274 = getelementptr [34 x sbyte]* %.LC9, long 0, long 0 ; <sbyte*> [#uses=0]
%cast282 = cast ubyte* %reg111 to %FILE* ; <%FILE*> [#uses=0]
call void %exit( int 1 )
bb4: ; preds = %bb3
%reg111 = getelementptr [20 x %FILE]* @__iob, i64 0, i64 1, i32 3 ; <i8*> [#uses=1]
%cast274 = getelementptr [34 x i8]* @.LC9, i64 0, i64 0 ; <i8*> [#uses=0]
%cast282 = bitcast i8* %reg111 to %FILE* ; <%FILE*> [#uses=0]
call void @exit( i32 1 )
br label %UnifiedExitNode
bb5: ;[#uses=1]
%reg107-idxcast1 = cast int %fd to long ; <long> [#uses=2]
%reg107-idxcast2 = cast int %fd to long ; <long> [#uses=1]
%reg1311 = getelementptr [3 x %spec_fd_t]* %spec_fd, long 0, long %reg107-idxcast2 ; <%spec_fd_t*> [#uses=1]
%idx1 = getelementptr [3 x %spec_fd_t]* %spec_fd, long 0, long %reg107-idxcast1, uint 2 ; <int> [#uses=3]
%reg1321 = load int* %idx1
%idx2 = getelementptr %spec_fd_t* %reg1311, long 0, uint 1 ; <int> [#uses=1]
%reg1331 = load int* %idx2
%cond270 = setlt int %reg1321, %reg1331 ; <bool> [#uses=1]
br bool %cond270, label %bb9, label %bb6
bb5: ; preds = %bb3
%reg107-idxcast1 = sext i32 %fd to i64 ; <i64> [#uses=2]
%reg107-idxcast2 = sext i32 %fd to i64 ; <i64> [#uses=1]
%reg1311 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast2 ; <%spec_fd_t*> [#uses=1]
%idx1 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <i32*> [#uses=1]
%reg1321 = load i32* %idx1 ; <i32> [#uses=3]
%idx2 = getelementptr %spec_fd_t* %reg1311, i64 0, i32 1 ; <i32*> [#uses=1]
%reg1331 = load i32* %idx2 ; <i32> [#uses=1]
%cond270 = icmp slt i32 %reg1321, %reg1331 ; <i1> [#uses=1]
br i1 %cond270, label %bb9, label %bb6
bb6: ;[#uses=1]
%reg134 = load int* %dbglvl ; <int> [#uses=1]
%cond271 = setle int %reg134, 4 ; <bool> [#uses=1]
br bool %cond271, label %bb8, label %bb7
bb6: ; preds = %bb5
%reg134 = load i32* @dbglvl ; <i32> [#uses=1]
%cond271 = icmp sle i32 %reg134, 4 ; <i1> [#uses=1]
br i1 %cond271, label %bb8, label %bb7
bb7: ;[#uses=1]
%cast277 = getelementptr [4 x sbyte]* %.LC10, long 0, long 0 ; <sbyte*> [#uses=0]
bb7: ; preds = %bb6
%cast277 = getelementptr [4 x i8]* @.LC10, i64 0, i64 0 ; <i8*> [#uses=0]
br label %bb8
bb8: ;[#uses=3]
bb8: ; preds = %bb7, %bb6
br label %UnifiedExitNode
bb9: ;[#uses=1]
%reg107-idxcast3 = cast int %fd to long ; <long> [#uses=1]
%idx3 = getelementptr [3 x %spec_fd_t]* %spec_fd, long 0, long %reg107-idxcast3, uint 3 ; <ubyte*> [#uses=1]
%reg1601 = load ubyte** %idx3
%reg132-idxcast1 = cast int %reg1321 to long ; <long> [#uses=1]
%idx4 = getelementptr ubyte* %reg1601, long %reg132-idxcast1 ; <ubyte> [#uses=2]
%reg1621 = load ubyte* %idx4
%cast108 = cast ubyte %reg1621 to long ; <long> [#uses=0]
%reg157 = add int %reg1321, 1 ; <int> [#uses=1]
%idx5 = getelementptr [3 x %spec_fd_t]* %spec_fd, long 0, long %reg107-idxcast1, uint 2
store int %reg157, int* %idx5
%reg163 = load int* %dbglvl ; <int> [#uses=1]
%cond272 = setle int %reg163, 4 ; <bool> [#uses=1]
br bool %cond272, label %bb11, label %bb10
bb9: ; preds = %bb5
%reg107-idxcast3 = sext i32 %fd to i64 ; <i64> [#uses=1]
%idx3 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast3, i32 3 ; <i8**> [#uses=1]
%reg1601 = load i8** %idx3 ; <i8*> [#uses=1]
%reg132-idxcast1 = sext i32 %reg1321 to i64 ; <i64> [#uses=1]
%idx4 = getelementptr i8* %reg1601, i64 %reg132-idxcast1 ; <i8*> [#uses=1]
%reg1621 = load i8* %idx4 ; <i8> [#uses=2]
%cast108 = zext i8 %reg1621 to i64 ; <i64> [#uses=0]
%reg157 = add i32 %reg1321, 1 ; <i32> [#uses=1]
%idx5 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <i32*> [#uses=1]
store i32 %reg157, i32* %idx5
%reg163 = load i32* @dbglvl ; <i32> [#uses=1]
%cond272 = icmp sle i32 %reg163, 4 ; <i1> [#uses=1]
br i1 %cond272, label %bb11, label %bb10
bb10: ;[#uses=1]
%cast279 = getelementptr [4 x sbyte]* %.LC11, long 0, long 0 ; <sbyte*> [#uses=0]
bb10: ; preds = %bb9
%cast279 = getelementptr [4 x i8]* @.LC11, i64 0, i64 0 ; <i8*> [#uses=0]
br label %bb11
bb11: ;[#uses=3]
%cast291 = cast ubyte %reg1621 to int ; <int> [#uses=1]
bb11: ; preds = %bb10, %bb9
%cast291 = zext i8 %reg1621 to i32 ; <i32> [#uses=1]
br label %UnifiedExitNode
UnifiedExitNode: ;[#uses=3]
%UnifiedRetVal = phi int [ 42, %bb4 ], [ -1, %bb8 ], [ %cast291, %bb11 ] ; <int> [#uses=1]
ret int %UnifiedRetVal
UnifiedExitNode: ; preds = %bb11, %bb8, %bb4
%UnifiedRetVal = phi i32 [ 42, %bb4 ], [ -1, %bb8 ], [ %cast291, %bb11 ] ; <i32> [#uses=1]
ret i32 %UnifiedRetVal
}
declare int "puts"(sbyte*)
declare i32 @puts(i8*)
declare int "printf"(sbyte*, ...)
declare i32 @printf(i8*, ...)

View File

@ -1,102 +1,97 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce -simplifycfg | llvm-dis
; RUN: llvm-as < %s | opt -adce -simplifycfg | llvm-dis
%FILE = type { i32, i8*, i8*, i8, i8, i32, i32, i32 }
%spec_fd_t = type { i32, i32, i32, i8* }
@__iob = external global [20 x %FILE] ; <[20 x %FILE]*> [#uses=1]
@dbglvl = global i32 4 ; <i32*> [#uses=3]
@spec_fd = external global [3 x %spec_fd_t] ; <[3 x %spec_fd_t]*> [#uses=4]
@.LC9 = internal global [34 x i8] c"spec_read: fd=%d, > MAX_SPEC_FD!\0A\00" ; <[34 x i8]*> [#uses=1]
@.LC10 = internal global [4 x i8] c"EOF\00" ; <[4 x i8]*> [#uses=1]
@.LC11 = internal global [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
@.LC12 = internal global [17 x i8] c"spec_getc: %d = \00" ; <[17 x i8]*> [#uses=1]
%FILE = type { int, ubyte*, ubyte*, ubyte, ubyte, uint, uint, uint }
%spec_fd_t = type { int, int, int, ubyte* }
%__iob = uninitialized global [20 x %FILE] ; <[20 x %FILE]*> [#uses=1]
%dbglvl = global int 4 ; <int*> [#uses=3]
%spec_fd = uninitialized global [3 x %spec_fd_t] ; <[3 x %spec_fd_t]*> [#uses=4]
%.LC9 = internal global [34 x sbyte] c"spec_read: fd=%d, > MAX_SPEC_FD!\0A\00" ; <[34 x sbyte]*> [#uses=1]
%.LC10 = internal global [4 x sbyte] c"EOF\00" ; <[4 x sbyte]*> [#uses=1]
%.LC11 = internal global [4 x sbyte] c"%d\0A\00" ; <[4 x sbyte]*> [#uses=1]
%.LC12 = internal global [17 x sbyte] c"spec_getc: %d = \00" ; <[17 x sbyte]*> [#uses=1]
declare i32 @fprintf(%FILE*, i8*, ...)
implementation ; Functions:
declare void @exit(i32)
declare int "fprintf"(%FILE*, sbyte*, ...)
declare i32 @remove(i8*)
declare void "exit"(int)
declare i32 @fputc(i32, %FILE*)
declare int "remove"(sbyte*)
declare i32 @fwrite(i8*, i32, i32, %FILE*)
declare int "fputc"(int, %FILE*)
declare void @perror(i8*)
declare uint "fwrite"(sbyte*, uint, uint, %FILE*)
define i32 @spec_getc(i32 %fd) {
%reg109 = load i32* @dbglvl ; <i32> [#uses=1]
%cond266 = icmp sle i32 %reg109, 4 ; <i1> [#uses=1]
br i1 %cond266, label %bb3, label %bb2
declare void "perror"(sbyte*)
int "spec_getc"(int %fd) {
; <label>:0 ;[#uses=0]
%reg109 = load int* %dbglvl ; <int> [#uses=1]
%cond266 = setle int %reg109, 4 ; <bool> [#uses=1]
br bool %cond266, label %bb3, label %bb2
bb2: ;[#uses=1]
%cast273 = getelementptr [17 x sbyte]* %.LC12, long 0, long 0 ; <sbyte*> [#uses=0]
bb2: ; preds = %0
%cast273 = getelementptr [17 x i8]* @.LC12, i64 0, i64 0 ; <i8*> [#uses=0]
br label %bb3
bb3: ;[#uses=2]
%cond267 = setle int %fd, 3 ; <bool> [#uses=1]
; br bool %cond267, label %bb5, label %bb4
bb3: ; preds = %bb2, %0
%cond267 = icmp sle i32 %fd, 3 ; <i1> [#uses=0]
br label %bb5
bb4: ;[#uses=2]
%reg111 = getelementptr [20 x %FILE]* %__iob, long 0, long 1, uint 3 ; <ubyte*> [#uses=1]
%cast274 = getelementptr [34 x sbyte]* %.LC9, long 0, long 0 ; <sbyte*> [#uses=0]
%cast282 = cast ubyte* %reg111 to %FILE* ; <%FILE*> [#uses=0]
call void %exit( int 1 )
bb4: ; No predecessors!
%reg111 = getelementptr [20 x %FILE]* @__iob, i64 0, i64 1, i32 3 ; <i8*> [#uses=1]
%cast274 = getelementptr [34 x i8]* @.LC9, i64 0, i64 0 ; <i8*> [#uses=0]
%cast282 = bitcast i8* %reg111 to %FILE* ; <%FILE*> [#uses=0]
call void @exit( i32 1 )
br label %UnifiedExitNode
bb5: ;[#uses=1]
%reg107-idxcast1 = cast int %fd to long ; <long> [#uses=2]
%reg107-idxcast2 = cast int %fd to long ; <long> [#uses=1]
%reg1311 = getelementptr [3 x %spec_fd_t]* %spec_fd, long 0, long %reg107-idxcast2 ; <%spec_fd_t*> [#uses=1]
%idx1 = getelementptr [3 x %spec_fd_t]* %spec_fd, long 0, long %reg107-idxcast1, uint 2 ; <int> [#uses=3]
%reg1321 = load int* %idx1
%idx2 = getelementptr %spec_fd_t* %reg1311, long 0, uint 1 ; <int> [#uses=1]
%reg1331 = load int* %idx2
%cond270 = setlt int %reg1321, %reg1331 ; <bool> [#uses=1]
br bool %cond270, label %bb9, label %bb6
bb5: ; preds = %bb3
%reg107-idxcast1 = sext i32 %fd to i64 ; <i64> [#uses=2]
%reg107-idxcast2 = sext i32 %fd to i64 ; <i64> [#uses=1]
%reg1311 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast2 ; <%spec_fd_t*> [#uses=1]
%idx1 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <i32*> [#uses=1]
%reg1321 = load i32* %idx1 ; <i32> [#uses=3]
%idx2 = getelementptr %spec_fd_t* %reg1311, i64 0, i32 1 ; <i32*> [#uses=1]
%reg1331 = load i32* %idx2 ; <i32> [#uses=1]
%cond270 = icmp slt i32 %reg1321, %reg1331 ; <i1> [#uses=1]
br i1 %cond270, label %bb9, label %bb6
bb6: ;[#uses=1]
%reg134 = load int* %dbglvl ; <int> [#uses=1]
%cond271 = setle int %reg134, 4 ; <bool> [#uses=1]
br bool %cond271, label %bb8, label %bb7
bb6: ; preds = %bb5
%reg134 = load i32* @dbglvl ; <i32> [#uses=1]
%cond271 = icmp sle i32 %reg134, 4 ; <i1> [#uses=1]
br i1 %cond271, label %bb8, label %bb7
bb7: ;[#uses=1]
%cast277 = getelementptr [4 x sbyte]* %.LC10, long 0, long 0 ; <sbyte*> [#uses=0]
bb7: ; preds = %bb6
%cast277 = getelementptr [4 x i8]* @.LC10, i64 0, i64 0 ; <i8*> [#uses=0]
br label %bb8
bb8: ;[#uses=3]
bb8: ; preds = %bb7, %bb6
br label %UnifiedExitNode
bb9: ;[#uses=1]
%reg107-idxcast3 = cast int %fd to long ; <uint> [#uses=1]
%idx3 = getelementptr [3 x %spec_fd_t]* %spec_fd, long 0, long %reg107-idxcast3, uint 3 ; <ubyte*> [#uses=1]
%reg1601 = load ubyte** %idx3
%reg132-idxcast1 = cast int %reg1321 to long ; <long> [#uses=1]
%idx4 = getelementptr ubyte* %reg1601, long %reg132-idxcast1 ; <ubyte> [#uses=2]
%reg1621 = load ubyte* %idx4
%cast108 = cast ubyte %reg1621 to long ; <long> [#uses=0]
%reg157 = add int %reg1321, 1 ; <int> [#uses=1]
%idx5 = getelementptr [3 x %spec_fd_t]* %spec_fd, long 0, long %reg107-idxcast1, uint 2
store int %reg157, int* %idx5
%reg163 = load int* %dbglvl ; <int> [#uses=1]
%cond272 = setle int %reg163, 4 ; <bool> [#uses=1]
br bool %cond272, label %bb11, label %bb10
bb9: ; preds = %bb5
%reg107-idxcast3 = sext i32 %fd to i64 ; <i64> [#uses=1]
%idx3 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast3, i32 3 ; <i8**> [#uses=1]
%reg1601 = load i8** %idx3 ; <i8*> [#uses=1]
%reg132-idxcast1 = sext i32 %reg1321 to i64 ; <i64> [#uses=1]
%idx4 = getelementptr i8* %reg1601, i64 %reg132-idxcast1 ; <i8*> [#uses=1]
%reg1621 = load i8* %idx4 ; <i8> [#uses=2]
%cast108 = zext i8 %reg1621 to i64 ; <i64> [#uses=0]
%reg157 = add i32 %reg1321, 1 ; <i32> [#uses=1]
%idx5 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <i32*> [#uses=1]
store i32 %reg157, i32* %idx5
%reg163 = load i32* @dbglvl ; <i32> [#uses=1]
%cond272 = icmp sle i32 %reg163, 4 ; <i1> [#uses=1]
br i1 %cond272, label %bb11, label %bb10
bb10: ;[#uses=1]
%cast279 = getelementptr [4 x sbyte]* %.LC11, long 0, long 0 ; <sbyte*> [#uses=0]
bb10: ; preds = %bb9
%cast279 = getelementptr [4 x i8]* @.LC11, i64 0, i64 0 ; <i8*> [#uses=0]
br label %bb11
bb11: ;[#uses=3]
%cast291 = cast ubyte %reg1621 to int ; <int> [#uses=1]
bb11: ; preds = %bb10, %bb9
%cast291 = zext i8 %reg1621 to i32 ; <i32> [#uses=1]
br label %UnifiedExitNode
UnifiedExitNode: ;[#uses=3]
%UnifiedRetVal = phi int [ 42, %bb4 ], [ -1, %bb8 ], [ %cast291, %bb11 ] ; <int> [#uses=1]
ret int %UnifiedRetVal
UnifiedExitNode: ; preds = %bb11, %bb8, %bb4
%UnifiedRetVal = phi i32 [ 42, %bb4 ], [ -1, %bb8 ], [ %cast291, %bb11 ] ; <i32> [#uses=1]
ret i32 %UnifiedRetVal
}
declare int "puts"(sbyte*)
declare i32 @puts(i8*)
declare int "printf"(sbyte*, ...)
declare i32 @printf(i8*, ...)

View File

@ -1,15 +1,17 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce | llvm-dis | not grep call
; RUN: llvm-as < %s | opt -adce | llvm-dis | not grep call
; The call is not live just because the PHI uses the call retval!
int %test(int %X) {
br label %Done
define i32 @test(i32 %X) {
; <label>:0
br label %Done
DeadBlock:
%Y = call int %test(int 0)
br label %Done
DeadBlock: ; No predecessors!
%Y = call i32 @test( i32 0 ) ; <i32> [#uses=1]
br label %Done
Done:
%Z = phi int [%X, %0], [%Y, %DeadBlock]
ret int %Z
Done: ; preds = %DeadBlock, %0
%Z = phi i32 [ %X, %0 ], [ %Y, %DeadBlock ] ; <i32> [#uses=1]
ret i32 %Z
}

View File

@ -1,5 +1,5 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -adce -disable-output
; RUN: llvm-as < %s | opt -adce -disable-output
void %test() {
define void @test() {
unreachable
}

View File

@ -1,21 +1,23 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -argpromotion -instcombine | not grep load
; RUN: llvm-as < %s | opt -argpromotion -instcombine | not grep load
%QuadTy = type {int, int, int, int}
%QuadTy = type { i32, i32, i32, i32 }
@G = constant %QuadTy {
i32 0,
i32 0,
i32 17,
i32 25 } ; <%QuadTy*> [#uses=1]
%G = constant %QuadTy {int 0, int 0, int 17, int 25 }
implementation
internal int %test(%QuadTy* %P) {
%A = getelementptr %QuadTy* %P, long 0, uint 3
%B = getelementptr %QuadTy* %P, long 0, uint 2
%a = load int* %A
%b = load int* %B
%V = add int %a, %b
ret int %V
define internal i32 @test(%QuadTy* %P) {
%A = getelementptr %QuadTy* %P, i64 0, i32 3 ; <i32*> [#uses=1]
%B = getelementptr %QuadTy* %P, i64 0, i32 2 ; <i32*> [#uses=1]
%a = load i32* %A ; <i32> [#uses=1]
%b = load i32* %B ; <i32> [#uses=1]
%V = add i32 %a, %b ; <i32> [#uses=1]
ret i32 %V
}
int %caller() {
%V = call int %test(%QuadTy* %G)
ret int %V
define i32 @caller() {
%V = call i32 @test( %QuadTy* @G ) ; <i32> [#uses=1]
ret i32 %V
}

View File

@ -1,24 +1,22 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -argpromotion -mem2reg | llvm-dis | not grep alloca
implementation
internal int %test(int *%X, int* %Y) {
%A = load int* %X
%B = load int* %Y
%C = add int %A, %B
ret int %C
; RUN: llvm-as < %s | opt -argpromotion -mem2reg | llvm-dis | not grep alloca
define internal i32 @test(i32* %X, i32* %Y) {
%A = load i32* %X ; <i32> [#uses=1]
%B = load i32* %Y ; <i32> [#uses=1]
%C = add i32 %A, %B ; <i32> [#uses=1]
ret i32 %C
}
internal int %caller(int* %B) {
%A = alloca int
store int 1, int* %A
%C = call int %test(int* %A, int* %B)
ret int %C
define internal i32 @caller(i32* %B) {
%A = alloca i32 ; <i32*> [#uses=2]
store i32 1, i32* %A
%C = call i32 @test( i32* %A, i32* %B ) ; <i32> [#uses=1]
ret i32 %C
}
int %callercaller() {
%B = alloca int
store int 2, int* %B
%X = call int %caller(int* %B)
ret int %X
define i32 @callercaller() {
%B = alloca i32 ; <i32*> [#uses=2]
store i32 2, i32* %B
%X = call i32 @caller( i32* %B ) ; <i32> [#uses=1]
ret i32 %X
}

View File

@ -1,17 +1,16 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -argpromotion -instcombine | llvm-dis | not grep load
; RUN: llvm-as < %s | opt -argpromotion -instcombine | llvm-dis | not grep load
%G1 = constant int 0
%G2 = constant int* %G1
@G1 = constant i32 0 ; <i32*> [#uses=1]
@G2 = constant i32* @G1 ; <i32**> [#uses=1]
implementation
internal int %test(int **%X) {
%Y = load int** %X
%X = load int* %Y
ret int %X
define internal i32 @test(i32** %X) {
%Y = load i32** %X ; <i32*> [#uses=1]
%X.upgrd.1 = load i32* %Y ; <i32> [#uses=1]
ret i32 %X.upgrd.1
}
int %caller(int** %P) {
%X = call int %test(int** %G2)
ret int %X
define i32 @caller(i32** %P) {
%X = call i32 @test( i32** @G2 ) ; <i32> [#uses=1]
ret i32 %X
}

View File

@ -1,19 +1,19 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -argpromotion | llvm-dis | \
; RUN: llvm-as < %s | opt -argpromotion | llvm-dis | \
; RUN: not grep {load int\* null}
implementation
define internal i32 @callee(i1 %C, i32* %P) {
br i1 %C, label %T, label %F
internal int %callee(bool %C, int* %P) {
br bool %C, label %T, label %F
T:
ret int 17
F:
%X = load int* %P
ret int %X
T: ; preds = %0
ret i32 17
F: ; preds = %0
%X = load i32* %P ; <i32> [#uses=1]
ret i32 %X
}
int %foo() {
%X = call int %callee(bool true, int* null)
ret int %X
define i32 @foo() {
%X = call i32 @callee( i1 true, i32* null ) ; <i32> [#uses=1]
ret i32 %X
}

View File

@ -1,21 +1,21 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -argpromotion | llvm-dis | \
; RUN: llvm-as < %s | opt -argpromotion | llvm-dis | \
; RUN: grep {load i32\\* %A}
implementation
define internal i32 @callee(i1 %C, i32* %P) {
br i1 %C, label %T, label %F
internal int %callee(bool %C, int* %P) {
br bool %C, label %T, label %F
T:
ret int 17
F:
%X = load int* %P
ret int %X
T: ; preds = %0
ret i32 17
F: ; preds = %0
%X = load i32* %P ; <i32> [#uses=1]
ret i32 %X
}
int %foo() {
%A = alloca int
store int 17, int* %A
%X = call int %callee(bool false, int* %A)
ret int %X
define i32 @foo() {
%A = alloca i32 ; <i32*> [#uses=2]
store i32 17, i32* %A
%X = call i32 @callee( i1 false, i32* %A ) ; <i32> [#uses=1]
ret i32 %X
}

View File

@ -1,12 +1,15 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -block-placement -disable-output -print
; RUN: llvm-as < %s | opt -block-placement -disable-output -print
int %test() {
define i32 @test() {
br i1 true, label %X, label %Y
br bool true, label %X, label %Y
A:
ret int 0
X:
br label %A
Y:
br label %A
A: ; preds = %Y, %X
ret i32 0
X: ; preds = %0
br label %A
Y: ; preds = %0
br label %A
}

View File

@ -1,26 +1,26 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -loop-extract -disable-output
; RUN: llvm-as < %s | opt -loop-extract -disable-output
void %solve() {
define void @solve() {
entry:
br label %loopentry.0
loopentry.0: ; preds = %entry, %endif.0
br bool false, label %no_exit.0, label %loopexit.0
loopentry.0: ; preds = %endif.0, %entry
br i1 false, label %no_exit.0, label %loopexit.0
no_exit.0: ; preds = %loopentry.0
br bool false, label %then.0, label %endif.0
br i1 false, label %then.0, label %endif.0
then.0: ; preds = %no_exit.0
br bool false, label %shortcirc_done, label %shortcirc_next
br i1 false, label %shortcirc_done, label %shortcirc_next
shortcirc_next: ; preds = %then.0
br label %shortcirc_done
shortcirc_done: ; preds = %then.0, %shortcirc_next
br bool false, label %then.1, label %endif.1
shortcirc_done: ; preds = %shortcirc_next, %then.0
br i1 false, label %then.1, label %endif.1
then.1: ; preds = %shortcirc_done
br bool false, label %cond_true, label %cond_false
br i1 false, label %cond_true, label %cond_false
cond_true: ; preds = %then.1
br label %cond_continue
@ -28,23 +28,23 @@ cond_true: ; preds = %then.1
cond_false: ; preds = %then.1
br label %cond_continue
cond_continue: ; preds = %cond_true, %cond_false
cond_continue: ; preds = %cond_false, %cond_true
br label %return
after_ret.0: ; No predecessors!
br label %endif.1
endif.1: ; preds = %shortcirc_done, %after_ret.0
endif.1: ; preds = %after_ret.0, %shortcirc_done
br label %endif.0
endif.0: ; preds = %no_exit.0, %endif.1
endif.0: ; preds = %endif.1, %no_exit.0
br label %loopentry.0
loopexit.0: ; preds = %loopentry.0
br bool false, label %then.2, label %endif.2
br i1 false, label %then.2, label %endif.2
then.2: ; preds = %loopexit.0
br bool false, label %then.3, label %endif.3
br i1 false, label %then.3, label %endif.3
then.3: ; preds = %then.2
br label %return
@ -52,14 +52,14 @@ then.3: ; preds = %then.2
after_ret.1: ; No predecessors!
br label %endif.3
endif.3: ; preds = %then.2, %after_ret.1
endif.3: ; preds = %after_ret.1, %then.2
br label %endif.2
endif.2: ; preds = %loopexit.0, %endif.3
endif.2: ; preds = %endif.3, %loopexit.0
br label %loopentry.1
loopentry.1: ; preds = %endif.2, %no_exit.1
br bool false, label %no_exit.1, label %loopexit.1
loopentry.1: ; preds = %no_exit.1, %endif.2
br i1 false, label %no_exit.1, label %loopexit.1
no_exit.1: ; preds = %loopentry.1
br label %loopentry.1
@ -70,6 +70,6 @@ loopexit.1: ; preds = %loopentry.1
after_ret.2: ; No predecessors!
br label %return
return: ; preds = %cond_continue, %then.3, %loopexit.1, %after_ret.2
return: ; preds = %after_ret.2, %loopexit.1, %then.3, %cond_continue
ret void
}

View File

@ -1,34 +1,33 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -loop-extract -disable-output
; RUN: llvm-as < %s | opt -loop-extract -disable-output
; This testcase is failing the loop extractor because not all exit blocks
; are dominated by all of the live-outs.
implementation ; Functions:
int %ab(int %alpha, int %beta) {
define i32 @ab(i32 %alpha, i32 %beta) {
entry:
br label %loopentry.1.preheader
br label %loopentry.1.preheader
loopentry.1.preheader: ; preds = %then.1
br label %loopentry.1
loopentry.1.preheader: ; preds = %entry
br label %loopentry.1
loopentry.1: ; preds = %loopentry.1.preheader, %no_exit.1
br bool false, label %no_exit.1, label %loopexit.0.loopexit1
loopentry.1: ; preds = %no_exit.1, %loopentry.1.preheader
br i1 false, label %no_exit.1, label %loopexit.0.loopexit1
no_exit.1: ; preds = %loopentry.1
%tmp.53 = load int* null ; <int> [#uses=1]
br bool false, label %shortcirc_next.2, label %loopentry.1
no_exit.1: ; preds = %loopentry.1
%tmp.53 = load i32* null ; <i32> [#uses=1]
br i1 false, label %shortcirc_next.2, label %loopentry.1
shortcirc_next.2: ; preds = %no_exit.1
%tmp.563 = call int %wins( int 0, int %tmp.53, int 3 ) ; <int> [#uses=0]
ret int 0
shortcirc_next.2: ; preds = %no_exit.1
%tmp.563 = call i32 @wins( i32 0, i32 %tmp.53, i32 3 ) ; <i32> [#uses=0]
ret i32 0
loopexit.0.loopexit1: ; preds = %loopentry.1
br label %loopexit.0
loopexit.0.loopexit1: ; preds = %loopentry.1
br label %loopexit.0
loopexit.0: ; preds = %loopexit.0.loopexit, %loopexit.0.loopexit1
ret int 0
loopexit.0: ; preds = %loopexit.0.loopexit1
ret i32 0
}
declare int %wins(int, int, int)
declare i32 @wins(i32, i32, i32)
declare i16 @ab_code()
declare ushort %ab_code()

View File

@ -1,27 +1,28 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -loop-extract-single -disable-output
; RUN: llvm-as < %s | opt -loop-extract-single -disable-output
void %ab() {
define void @ab() {
entry:
br label %codeReplTail
br label %codeReplTail
then.1: ; preds = %codeReplTail
br label %loopentry.1
then.1: ; preds = %codeReplTail
br label %loopentry.1
loopentry.1: ; preds = %loopentry.1.preheader, %no_exit.1
br bool false, label %no_exit.1, label %loopexit.0.loopexit1
loopentry.1: ; preds = %no_exit.1, %then.1
br i1 false, label %no_exit.1, label %loopexit.0.loopexit1
no_exit.1: ; preds = %loopentry.1
br label %loopentry.1
no_exit.1: ; preds = %loopentry.1
br label %loopentry.1
loopexit.0.loopexit: ; preds = %codeReplTail
ret void
loopexit.0.loopexit: ; preds = %codeReplTail
ret void
loopexit.0.loopexit1: ; preds = %loopentry.1
ret void
loopexit.0.loopexit1: ; preds = %loopentry.1
ret void
codeReplTail: ; preds = %codeRepl, %codeReplTail
switch ushort 0, label %codeReplTail [
ushort 0, label %loopexit.0.loopexit
ushort 1, label %then.1
]
codeReplTail: ; preds = %codeReplTail, %entry
switch i16 0, label %codeReplTail [
i16 0, label %loopexit.0.loopexit
i16 1, label %then.1
]
}

View File

@ -1,11 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -loop-extract -disable-output
; RUN: llvm-as < %s | opt -loop-extract -disable-output
void %sendMTFValues() {
define void @sendMTFValues() {
entry:
br bool false, label %then.1, label %endif.1
br i1 false, label %then.1, label %endif.1
then.1: ; preds = %entry
br bool false, label %loopentry.6.preheader, label %else.0
br i1 false, label %loopentry.6.preheader, label %else.0
endif.1: ; preds = %entry
ret void
@ -14,34 +14,34 @@ else.0: ; preds = %then.1
ret void
loopentry.6.preheader: ; preds = %then.1
br bool false, label %endif.7.preheader, label %loopexit.9
br i1 false, label %endif.7.preheader, label %loopexit.9
endif.7.preheader: ; preds = %loopentry.6.preheader
%tmp.183 = add int 0, -1 ; <int> [#uses=1]
%tmp.183 = add i32 0, -1 ; <i32> [#uses=1]
br label %endif.7
endif.7: ; preds = %endif.7.preheader, %loopexit.15
br bool false, label %loopentry.10, label %loopentry.12
endif.7: ; preds = %loopexit.15, %endif.7.preheader
br i1 false, label %loopentry.10, label %loopentry.12
loopentry.10: ; preds = %endif.7
br label %loopentry.12
loopentry.12: ; preds = %endif.7, %loopentry.10
%ge.2.1 = phi int [ 0, %loopentry.10 ], [ %tmp.183, %endif.7 ] ; <int> [#uses=0]
br bool false, label %loopexit.14, label %no_exit.11
loopentry.12: ; preds = %loopentry.10, %endif.7
%ge.2.1 = phi i32 [ 0, %loopentry.10 ], [ %tmp.183, %endif.7 ] ; <i32> [#uses=0]
br i1 false, label %loopexit.14, label %no_exit.11
no_exit.11: ; preds = %loopentry.12
ret void
loopexit.14: ; preds = %loopentry.12
br bool false, label %loopexit.15, label %no_exit.14
br i1 false, label %loopexit.15, label %no_exit.14
no_exit.14: ; preds = %loopexit.14
ret void
loopexit.15: ; preds = %loopexit.14
br bool false, label %endif.7, label %loopexit.9
br i1 false, label %endif.7, label %loopexit.9
loopexit.9: ; preds = %loopentry.6.preheader, %loopexit.15
loopexit.9: ; preds = %loopexit.15, %loopentry.6.preheader
ret void
}

View File

@ -1,21 +1,20 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -loop-extract -disable-output
; RUN: llvm-as < %s | opt -loop-extract -disable-output
%struct.node_t = type { double*, %struct.node_t*, %struct.node_t**, double**, double*, int, int }
%struct.table_t = type { [1 x %struct.node_t**], [1 x %struct.node_t**] }
%struct.node_t = type { double*, %struct.node_t*, %struct.node_t**, double**, double*, i32, i32 }
%struct.table_t = type { [1 x %struct.node_t**], [1 x %struct.node_t**] }
implementation ; Functions:
void %make_tables() {
define void @make_tables() {
entry:
%tmp.0.i = malloc %struct.node_t ; <%struct.node_t*> [#uses=1]
br bool false, label %no_exit.i, label %loopexit.i
%tmp.0.i = malloc %struct.node_t ; <%struct.node_t*> [#uses=1]
br i1 false, label %no_exit.i, label %loopexit.i
no_exit.i: ; preds = %entry, %no_exit.i
%prev_node.0.i.1 = phi %struct.node_t* [ %tmp.16.i, %no_exit.i ], [ %tmp.0.i, %entry ] ; <%struct.node_t*> [#uses=0]
%tmp.16.i = malloc %struct.node_t ; <%struct.node_t*> [#uses=2]
br bool false, label %no_exit.i, label %loopexit.i
no_exit.i: ; preds = %no_exit.i, %entry
%prev_node.0.i.1 = phi %struct.node_t* [ %tmp.16.i, %no_exit.i ], [ %tmp.0.i, %entry ] ; <%struct.node_t*> [#uses=0]
%tmp.16.i = malloc %struct.node_t ; <%struct.node_t*> [#uses=2]
br i1 false, label %no_exit.i, label %loopexit.i
loopexit.i: ; preds = %entry, %no_exit.i
%cur_node.0.i.0 = phi %struct.node_t* [ null, %entry ], [ %tmp.16.i, %no_exit.i ] ; <%struct.node_t*> [#uses=0]
ret void
loopexit.i: ; preds = %no_exit.i, %entry
%cur_node.0.i.0 = phi %struct.node_t* [ null, %entry ], [ %tmp.16.i, %no_exit.i ] ; <%struct.node_t*> [#uses=0]
ret void
}

View File

@ -1,23 +1,23 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -loop-extract -disable-output
; RUN: llvm-as < %s | opt -loop-extract -disable-output
void %maketree() {
define void @maketree() {
entry:
br bool false, label %no_exit.1, label %loopexit.0
br i1 false, label %no_exit.1, label %loopexit.0
no_exit.1: ; preds = %entry, %expandbox.entry, %endif
br bool false, label %endif, label %expandbox.entry
no_exit.1: ; preds = %endif, %expandbox.entry, %entry
br i1 false, label %endif, label %expandbox.entry
expandbox.entry: ; preds = %no_exit.1
br bool false, label %loopexit.1, label %no_exit.1
expandbox.entry: ; preds = %no_exit.1
br i1 false, label %loopexit.1, label %no_exit.1
endif: ; preds = %no_exit.1
br bool false, label %loopexit.1, label %no_exit.1
endif: ; preds = %no_exit.1
br i1 false, label %loopexit.1, label %no_exit.1
loopexit.1: ; preds = %expandbox.entry, %endif
%ic.i.0.0.4 = phi int [ 0, %expandbox.entry ], [ 0, %endif ] ; <int> [#uses=0]
ret void
loopexit.1: ; preds = %endif, %expandbox.entry
%ic.i.0.0.4 = phi i32 [ 0, %expandbox.entry ], [ 0, %endif ] ; <i32> [#uses=0]
ret void
loopexit.0: ; preds = %entry
ret void
loopexit.0: ; preds = %entry
ret void
}

View File

@ -1,97 +1,95 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -loop-extract -disable-output
; RUN: llvm-as < %s | opt -loop-extract -disable-output
implementation ; Functions:
declare i32 @_IO_getc()
declare int %_IO_getc()
declare void @__errno_location()
declare void %__errno_location()
void %yylex() {
define void @yylex() {
entry:
switch uint 0, label %label.126 [
uint 0, label %return
uint 61, label %combine
uint 33, label %combine
uint 94, label %combine
uint 37, label %combine
uint 47, label %combine
uint 42, label %combine
uint 62, label %combine
uint 60, label %combine
uint 58, label %combine
uint 124, label %combine
uint 38, label %combine
uint 45, label %combine
uint 43, label %combine
uint 34, label %string_constant
uint 39, label %char_constant
uint 46, label %loopexit.2
uint 57, label %loopexit.2
uint 56, label %loopexit.2
uint 55, label %loopexit.2
uint 54, label %loopexit.2
uint 53, label %loopexit.2
uint 52, label %loopexit.2
uint 51, label %loopexit.2
uint 50, label %loopexit.2
uint 49, label %loopexit.2
uint 48, label %loopexit.2
uint 95, label %letter
uint 122, label %letter
uint 121, label %letter
uint 120, label %letter
uint 119, label %letter
uint 118, label %letter
uint 117, label %letter
uint 116, label %letter
uint 115, label %letter
uint 114, label %letter
uint 113, label %letter
uint 112, label %letter
uint 111, label %letter
uint 110, label %letter
uint 109, label %letter
uint 108, label %letter
uint 107, label %letter
uint 106, label %letter
uint 105, label %letter
uint 104, label %letter
uint 103, label %letter
uint 102, label %letter
uint 101, label %letter
uint 100, label %letter
uint 99, label %letter
uint 98, label %letter
uint 97, label %letter
uint 90, label %letter
uint 89, label %letter
uint 88, label %letter
uint 87, label %letter
uint 86, label %letter
uint 85, label %letter
uint 84, label %letter
uint 83, label %letter
uint 82, label %letter
uint 81, label %letter
uint 80, label %letter
uint 79, label %letter
uint 78, label %letter
uint 77, label %letter
uint 75, label %letter
uint 74, label %letter
uint 73, label %letter
uint 72, label %letter
uint 71, label %letter
uint 70, label %letter
uint 69, label %letter
uint 68, label %letter
uint 67, label %letter
uint 66, label %letter
uint 65, label %letter
uint 64, label %label.13
uint 76, label %label.12
uint 36, label %label.11
uint 4294967295, label %label.10
switch i32 0, label %label.126 [
i32 0, label %return
i32 61, label %combine
i32 33, label %combine
i32 94, label %combine
i32 37, label %combine
i32 47, label %combine
i32 42, label %combine
i32 62, label %combine
i32 60, label %combine
i32 58, label %combine
i32 124, label %combine
i32 38, label %combine
i32 45, label %combine
i32 43, label %combine
i32 34, label %string_constant
i32 39, label %char_constant
i32 46, label %loopexit.2
i32 57, label %loopexit.2
i32 56, label %loopexit.2
i32 55, label %loopexit.2
i32 54, label %loopexit.2
i32 53, label %loopexit.2
i32 52, label %loopexit.2
i32 51, label %loopexit.2
i32 50, label %loopexit.2
i32 49, label %loopexit.2
i32 48, label %loopexit.2
i32 95, label %letter
i32 122, label %letter
i32 121, label %letter
i32 120, label %letter
i32 119, label %letter
i32 118, label %letter
i32 117, label %letter
i32 116, label %letter
i32 115, label %letter
i32 114, label %letter
i32 113, label %letter
i32 112, label %letter
i32 111, label %letter
i32 110, label %letter
i32 109, label %letter
i32 108, label %letter
i32 107, label %letter
i32 106, label %letter
i32 105, label %letter
i32 104, label %letter
i32 103, label %letter
i32 102, label %letter
i32 101, label %letter
i32 100, label %letter
i32 99, label %letter
i32 98, label %letter
i32 97, label %letter
i32 90, label %letter
i32 89, label %letter
i32 88, label %letter
i32 87, label %letter
i32 86, label %letter
i32 85, label %letter
i32 84, label %letter
i32 83, label %letter
i32 82, label %letter
i32 81, label %letter
i32 80, label %letter
i32 79, label %letter
i32 78, label %letter
i32 77, label %letter
i32 75, label %letter
i32 74, label %letter
i32 73, label %letter
i32 72, label %letter
i32 71, label %letter
i32 70, label %letter
i32 69, label %letter
i32 68, label %letter
i32 67, label %letter
i32 66, label %letter
i32 65, label %letter
i32 64, label %label.13
i32 76, label %label.12
i32 36, label %label.11
i32 -1, label %label.10
]
label.10: ; preds = %entry
@ -110,15 +108,15 @@ letter: ; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entr
ret void
loopexit.2: ; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry
switch int 0, label %shortcirc_next.14 [
int 48, label %then.20
int 46, label %endif.38
switch i32 0, label %shortcirc_next.14 [
i32 48, label %then.20
i32 46, label %endif.38
]
then.20: ; preds = %loopexit.2
switch int 0, label %else.4 [
int 120, label %then.21
int 88, label %then.21
switch i32 0, label %else.4 [
i32 120, label %then.21
i32 88, label %then.21
]
then.21: ; preds = %then.20, %then.20
@ -131,23 +129,23 @@ shortcirc_next.14: ; preds = %loopexit.2
ret void
endif.38: ; preds = %loopexit.2
br bool false, label %then.40, label %then.39
br i1 false, label %then.40, label %then.39
then.39: ; preds = %endif.38
ret void
then.40: ; preds = %endif.38
invoke void %__errno_location( )
invoke void @__errno_location( )
to label %switchexit.2 unwind label %LongJmpBlkPre
loopentry.6: ; preds = %endif.52
switch uint 0, label %switchexit.2 [
uint 73, label %label.82
uint 105, label %label.82
uint 76, label %label.80
uint 108, label %label.80
uint 70, label %label.78
uint 102, label %label.78
switch i32 0, label %switchexit.2 [
i32 73, label %label.82
i32 105, label %label.82
i32 76, label %label.80
i32 108, label %label.80
i32 70, label %label.78
i32 102, label %label.78
]
label.78: ; preds = %loopentry.6, %loopentry.6
@ -157,21 +155,21 @@ label.80: ; preds = %loopentry.6, %loopentry.6
ret void
label.82: ; preds = %loopentry.6, %loopentry.6
%c.0.15.5 = phi int [ %tmp.79417, %loopentry.6 ], [ %tmp.79417, %loopentry.6 ] ; <int> [#uses=0]
%c.0.15.5 = phi i32 [ %tmp.79417, %loopentry.6 ], [ %tmp.79417, %loopentry.6 ] ; <i32> [#uses=0]
ret void
switchexit.2: ; preds = %then.40, %loopentry.6
br bool false, label %endif.51, label %loopexit.6
switchexit.2: ; preds = %loopentry.6, %then.40
br i1 false, label %endif.51, label %loopexit.6
endif.51: ; preds = %switchexit.2
br bool false, label %endif.52, label %then.52
br i1 false, label %endif.52, label %then.52
then.52: ; preds = %endif.51
ret void
endif.52: ; preds = %endif.51
%tmp.79417 = invoke int %_IO_getc( )
to label %loopentry.6 unwind label %LongJmpBlkPre ; <int> [#uses=2]
%tmp.79417 = invoke i32 @_IO_getc( )
to label %loopentry.6 unwind label %LongJmpBlkPre ; <i32> [#uses=2]
loopexit.6: ; preds = %switchexit.2
ret void
@ -191,6 +189,6 @@ label.126: ; preds = %entry
return: ; preds = %entry
ret void
LongJmpBlkPre: ; preds = %then.40, %endif.52
LongJmpBlkPre: ; preds = %endif.52, %then.40
ret void
}

View File

@ -1,27 +1,26 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -extract-blocks -disable-output
; RUN: llvm-as < %s | opt -extract-blocks -disable-output
implementation
void %test1() {
define void @test1() {
no_exit.0.i:
br bool false, label %yylex.entry, label %yylex.entry
br i1 false, label %yylex.entry, label %yylex.entry
yylex.entry:
%tmp.1027 = phi int [ 0, %no_exit.0.i ], [ 0, %no_exit.0.i ]
ret void
yylex.entry: ; preds = %no_exit.0.i, %no_exit.0.i
%tmp.1027 = phi i32 [ 0, %no_exit.0.i ], [ 0, %no_exit.0.i ] ; <i32> [#uses=0]
ret void
}
void %test2() {
define void @test2() {
no_exit.0.i:
switch uint 0, label %yylex.entry [
uint 0, label %yylex.entry
uint 1, label %foo
switch i32 0, label %yylex.entry [
i32 0, label %yylex.entry
i32 1, label %foo
]
yylex.entry:
%tmp.1027 = phi int [ 0, %no_exit.0.i ], [ 0, %no_exit.0.i ]
yylex.entry: ; preds = %no_exit.0.i, %no_exit.0.i
%tmp.1027 = phi i32 [ 0, %no_exit.0.i ], [ 0, %no_exit.0.i ] ; <i32> [#uses=0]
ret void
foo:
foo: ; preds = %no_exit.0.i
ret void
}

View File

@ -1,10 +1,15 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -extract-blocks -disable-output
int %foo() {
br label %EB
EB:
%V = invoke int %foo() to label %Cont unwind label %Unw
Cont:
ret int %V
Unw:
unwind
; RUN: llvm-as < %s | opt -extract-blocks -disable-output
define i32 @foo() {
br label %EB
EB: ; preds = %0
%V = invoke i32 @foo( )
to label %Cont unwind label %Unw ; <i32> [#uses=1]
Cont: ; preds = %EB
ret i32 %V
Unw: ; preds = %EB
unwind
}

View File

@ -1,20 +1,16 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -condprop -disable-output
; RUN: llvm-as < %s | opt -condprop -disable-output
; PR877
target endian = big
target pointersize = 32
target datalayout = "E-p:32:32"
target triple = "powerpc-apple-darwin9.0.0d1"
"struct.kc::impl_Ccode_option" = type { "struct.kc::impl_abstract_phylum" }
"struct.kc::impl_ID" = type { "struct.kc::impl_abstract_phylum", "struct.kc::impl_Ccode_option"*, "struct.kc::impl_casestring__Str"*, int, "struct.kc::impl_casestring__Str"* }
"struct.kc::impl_abstract_phylum" = type { int (...)** }
"struct.kc::impl_casestring__Str" = type { "struct.kc::impl_abstract_phylum", sbyte* }
"struct.kc::impl_elem_patternrepresentation" = type { "struct.kc::impl_abstract_phylum", int, "struct.kc::impl_casestring__Str"*, "struct.kc::impl_ID"* }
"struct.kc::impl_outmostpatterns" = type { "struct.kc::impl_Ccode_option", "struct.kc::impl_elem_patternrepresentation"*, "struct.kc::impl_outmostpatterns"* }
"struct.kc::impl_patternrepresentations" = type { "struct.kc::impl_Ccode_option", "struct.kc::impl_outmostpatterns"*, "struct.kc::impl_patternrepresentations"* }
%"struct.kc::impl_Ccode_option" = type { %"struct.kc::impl_abstract_phylum" }
%"struct.kc::impl_ID" = type { %"struct.kc::impl_abstract_phylum", %"struct.kc::impl_Ccode_option"*, %"struct.kc::impl_casestring__Str"*, i32, %"struct.kc::impl_casestring__Str"* }
%"struct.kc::impl_abstract_phylum" = type { i32 (...)** }
%"struct.kc::impl_casestring__Str" = type { %"struct.kc::impl_abstract_phylum", i8* }
%"struct.kc::impl_elem_patternrepresentation" = type { %"struct.kc::impl_abstract_phylum", i32, %"struct.kc::impl_casestring__Str"*, %"struct.kc::impl_ID"* }
%"struct.kc::impl_outmostpatterns" = type { %"struct.kc::impl_Ccode_option", %"struct.kc::impl_elem_patternrepresentation"*, %"struct.kc::impl_outmostpatterns"* }
%"struct.kc::impl_patternrepresentations" = type { %"struct.kc::impl_Ccode_option", %"struct.kc::impl_outmostpatterns"*, %"struct.kc::impl_patternrepresentations"* }
implementation ; Functions:
void %_ZN2kc16compare_patternsEPNS_26impl_patternrepresentationES1_PNS_27impl_patternrepresentationsE() {
define void @_ZN2kc16compare_patternsEPNS_26impl_patternrepresentationES1_PNS_27impl_patternrepresentationsE() {
entry:
br label %bb1269.outer.outer.outer.outer
@ -22,55 +18,55 @@ cond_true: ; preds = %cond_true1298
br label %bb1269.outer69
cond_false: ; preds = %cond_true1298
br bool false, label %cond_next, label %bb51
br i1 false, label %cond_next, label %bb51
cond_next: ; preds = %cond_false
br bool false, label %bb52, label %bb51
br i1 false, label %bb52, label %bb51
bb51: ; preds = %cond_next, %cond_false
br label %bb52
bb52: ; preds = %bb51, %cond_next
br bool false, label %cond_false82, label %cond_true55
br i1 false, label %cond_false82, label %cond_true55
cond_true55: ; preds = %bb52
br bool false, label %UnifiedReturnBlock, label %cond_true57
br i1 false, label %UnifiedReturnBlock, label %cond_true57
cond_true57: ; preds = %cond_true55
br label %UnifiedReturnBlock
cond_false82: ; preds = %bb52
br bool false, label %cond_next97, label %bb113
br i1 false, label %cond_next97, label %bb113
cond_next97: ; preds = %cond_false82
br bool false, label %bb114, label %bb113
br i1 false, label %bb114, label %bb113
bb113: ; preds = %cond_next97, %cond_false82
br label %bb114
bb114: ; preds = %bb113, %cond_next97
br bool false, label %cond_false151, label %cond_true117
br i1 false, label %cond_false151, label %cond_true117
cond_true117: ; preds = %bb114
br bool false, label %UnifiedReturnBlock, label %cond_true120
br i1 false, label %UnifiedReturnBlock, label %cond_true120
cond_true120: ; preds = %cond_true117
br label %UnifiedReturnBlock
cond_false151: ; preds = %bb114
br bool false, label %cond_next166, label %bb182
br i1 false, label %cond_next166, label %bb182
cond_next166: ; preds = %cond_false151
br bool false, label %bb183, label %bb182
br i1 false, label %bb183, label %bb182
bb182: ; preds = %cond_next166, %cond_false151
br label %bb183
bb183: ; preds = %bb182, %cond_next166
br bool false, label %cond_false256, label %cond_true186
br i1 false, label %cond_false256, label %cond_true186
cond_true186: ; preds = %bb183
br bool false, label %cond_true207, label %cond_false214
br i1 false, label %cond_true207, label %cond_false214
cond_true207: ; preds = %cond_true186
br label %bb1269.outer38.backedge
@ -79,7 +75,7 @@ bb1269.outer38.backedge: ; preds = %cond_true545, %cond_true432, %cond_true320,
br label %bb1269.outer38
cond_false214: ; preds = %cond_true186
br bool false, label %cond_true228, label %cond_false235
br i1 false, label %cond_true228, label %cond_false235
cond_true228: ; preds = %cond_false214
br label %bb1269.outer21.backedge
@ -88,115 +84,115 @@ bb1269.outer21.backedge: ; preds = %cond_true566, %cond_true453, %cond_true341,
br label %bb1269.outer21
cond_false235: ; preds = %cond_false214
br bool false, label %UnifiedReturnBlock, label %cond_false250
br i1 false, label %UnifiedReturnBlock, label %cond_false250
cond_false250: ; preds = %cond_false235
br label %UnifiedUnreachableBlock
cond_false256: ; preds = %bb183
br bool false, label %cond_next271, label %bb287
br i1 false, label %cond_next271, label %bb287
cond_next271: ; preds = %cond_false256
br bool false, label %bb288, label %bb287
br i1 false, label %bb288, label %bb287
bb287: ; preds = %cond_next271, %cond_false256
br label %bb288
bb288: ; preds = %bb287, %cond_next271
br bool false, label %cond_false369, label %cond_true291
br i1 false, label %cond_false369, label %cond_true291
cond_true291: ; preds = %bb288
br bool false, label %cond_true320, label %cond_false327
br i1 false, label %cond_true320, label %cond_false327
cond_true320: ; preds = %cond_true291
br label %bb1269.outer38.backedge
cond_false327: ; preds = %cond_true291
br bool false, label %cond_true341, label %cond_false348
br i1 false, label %cond_true341, label %cond_false348
cond_true341: ; preds = %cond_false327
br label %bb1269.outer21.backedge
cond_false348: ; preds = %cond_false327
br bool false, label %UnifiedReturnBlock, label %cond_false363
br i1 false, label %UnifiedReturnBlock, label %cond_false363
cond_false363: ; preds = %cond_false348
br label %UnifiedUnreachableBlock
cond_false369: ; preds = %bb288
br bool false, label %cond_next384, label %bb400
br i1 false, label %cond_next384, label %bb400
cond_next384: ; preds = %cond_false369
br bool false, label %bb401, label %bb400
br i1 false, label %bb401, label %bb400
bb400: ; preds = %cond_next384, %cond_false369
br label %bb401
bb401: ; preds = %bb400, %cond_next384
br bool false, label %cond_false481, label %cond_true404
br i1 false, label %cond_false481, label %cond_true404
cond_true404: ; preds = %bb401
br bool false, label %cond_true432, label %cond_false439
br i1 false, label %cond_true432, label %cond_false439
cond_true432: ; preds = %cond_true404
br label %bb1269.outer38.backedge
cond_false439: ; preds = %cond_true404
br bool false, label %cond_true453, label %cond_false460
br i1 false, label %cond_true453, label %cond_false460
cond_true453: ; preds = %cond_false439
br label %bb1269.outer21.backedge
cond_false460: ; preds = %cond_false439
br bool false, label %UnifiedReturnBlock, label %cond_false475
br i1 false, label %UnifiedReturnBlock, label %cond_false475
cond_false475: ; preds = %cond_false460
br label %UnifiedUnreachableBlock
cond_false481: ; preds = %bb401
br bool false, label %cond_next496, label %bb512
br i1 false, label %cond_next496, label %bb512
cond_next496: ; preds = %cond_false481
br bool false, label %bb513, label %bb512
br i1 false, label %bb513, label %bb512
bb512: ; preds = %cond_next496, %cond_false481
br label %bb513
bb513: ; preds = %bb512, %cond_next496
br bool false, label %cond_false594, label %cond_true516
br i1 false, label %cond_false594, label %cond_true516
cond_true516: ; preds = %bb513
br bool false, label %cond_true545, label %cond_false552
br i1 false, label %cond_true545, label %cond_false552
cond_true545: ; preds = %cond_true516
br label %bb1269.outer38.backedge
cond_false552: ; preds = %cond_true516
br bool false, label %cond_true566, label %cond_false573
br i1 false, label %cond_true566, label %cond_false573
cond_true566: ; preds = %cond_false552
br label %bb1269.outer21.backedge
cond_false573: ; preds = %cond_false552
br bool false, label %UnifiedReturnBlock, label %cond_false588
br i1 false, label %UnifiedReturnBlock, label %cond_false588
cond_false588: ; preds = %cond_false573
br label %UnifiedUnreachableBlock
cond_false594: ; preds = %bb513
br bool false, label %cond_next609, label %bb625
br i1 false, label %cond_next609, label %bb625
cond_next609: ; preds = %cond_false594
br bool false, label %bb626, label %bb625
br i1 false, label %bb626, label %bb625
bb625: ; preds = %cond_next609, %cond_false594
br label %bb626
bb626: ; preds = %bb625, %cond_next609
br bool false, label %cond_false707, label %cond_true629
br i1 false, label %cond_false707, label %cond_true629
cond_true629: ; preds = %bb626
br bool false, label %cond_true658, label %cond_false665
br i1 false, label %cond_true658, label %cond_false665
cond_true658: ; preds = %cond_true629
br label %bb1269.outer2.backedge
@ -205,31 +201,31 @@ bb1269.outer2.backedge: ; preds = %cond_true679, %cond_true658
br label %bb1269.outer2
cond_false665: ; preds = %cond_true629
br bool false, label %cond_true679, label %cond_false686
br i1 false, label %cond_true679, label %cond_false686
cond_true679: ; preds = %cond_false665
br label %bb1269.outer2.backedge
cond_false686: ; preds = %cond_false665
br bool false, label %UnifiedReturnBlock, label %cond_false701
br i1 false, label %UnifiedReturnBlock, label %cond_false701
cond_false701: ; preds = %cond_false686
br label %UnifiedUnreachableBlock
cond_false707: ; preds = %bb626
br bool false, label %cond_next722, label %bb738
br i1 false, label %cond_next722, label %bb738
cond_next722: ; preds = %cond_false707
br bool false, label %bb739, label %bb738
br i1 false, label %bb739, label %bb738
bb738: ; preds = %cond_next722, %cond_false707
br label %bb739
bb739: ; preds = %bb738, %cond_next722
br bool false, label %cond_false820, label %cond_true742
br i1 false, label %cond_false820, label %cond_true742
cond_true742: ; preds = %bb739
br bool false, label %cond_true771, label %cond_false778
br i1 false, label %cond_true771, label %cond_false778
cond_true771: ; preds = %cond_true742
br label %bb1269.outer.backedge
@ -238,31 +234,31 @@ bb1269.outer.backedge: ; preds = %cond_true792, %cond_true771
br label %bb1269.outer
cond_false778: ; preds = %cond_true742
br bool false, label %cond_true792, label %cond_false799
br i1 false, label %cond_true792, label %cond_false799
cond_true792: ; preds = %cond_false778
br label %bb1269.outer.backedge
cond_false799: ; preds = %cond_false778
br bool false, label %UnifiedReturnBlock, label %cond_false814
br i1 false, label %UnifiedReturnBlock, label %cond_false814
cond_false814: ; preds = %cond_false799
br label %UnifiedUnreachableBlock
cond_false820: ; preds = %bb739
br bool false, label %cond_next835, label %bb851
br i1 false, label %cond_next835, label %bb851
cond_next835: ; preds = %cond_false820
br bool false, label %bb852, label %bb851
br i1 false, label %bb852, label %bb851
bb851: ; preds = %cond_next835, %cond_false820
br label %bb852
bb852: ; preds = %bb851, %cond_next835
br bool false, label %cond_false933, label %cond_true855
br i1 false, label %cond_false933, label %cond_true855
cond_true855: ; preds = %bb852
br bool false, label %cond_true884, label %cond_false891
br i1 false, label %cond_true884, label %cond_false891
cond_true884: ; preds = %cond_true855
br label %bb1269.outer.outer.backedge
@ -271,31 +267,31 @@ bb1269.outer.outer.backedge: ; preds = %cond_true905, %cond_true884
br label %bb1269.outer.outer
cond_false891: ; preds = %cond_true855
br bool false, label %cond_true905, label %cond_false912
br i1 false, label %cond_true905, label %cond_false912
cond_true905: ; preds = %cond_false891
br label %bb1269.outer.outer.backedge
cond_false912: ; preds = %cond_false891
br bool false, label %UnifiedReturnBlock, label %cond_false927
br i1 false, label %UnifiedReturnBlock, label %cond_false927
cond_false927: ; preds = %cond_false912
br label %UnifiedUnreachableBlock
cond_false933: ; preds = %bb852
br bool false, label %cond_next948, label %bb964
br i1 false, label %cond_next948, label %bb964
cond_next948: ; preds = %cond_false933
br bool false, label %bb965, label %bb964
br i1 false, label %bb965, label %bb964
bb964: ; preds = %cond_next948, %cond_false933
br label %bb965
bb965: ; preds = %bb964, %cond_next948
br bool false, label %cond_false1046, label %cond_true968
br i1 false, label %cond_false1046, label %cond_true968
cond_true968: ; preds = %bb965
br bool false, label %cond_true997, label %cond_false1004
br i1 false, label %cond_true997, label %cond_false1004
cond_true997: ; preds = %cond_true968
br label %bb1269.outer.outer.outer.backedge
@ -304,32 +300,32 @@ bb1269.outer.outer.outer.backedge: ; preds = %cond_true1018, %cond_true997
br label %bb1269.outer.outer.outer
cond_false1004: ; preds = %cond_true968
br bool false, label %cond_true1018, label %cond_false1025
br i1 false, label %cond_true1018, label %cond_false1025
cond_true1018: ; preds = %cond_false1004
br label %bb1269.outer.outer.outer.backedge
cond_false1025: ; preds = %cond_false1004
br bool false, label %UnifiedReturnBlock, label %cond_false1040
br i1 false, label %UnifiedReturnBlock, label %cond_false1040
cond_false1040: ; preds = %cond_false1025
br label %UnifiedUnreachableBlock
cond_false1046: ; preds = %bb965
br bool false, label %cond_next1061, label %bb1077
br i1 false, label %cond_next1061, label %bb1077
cond_next1061: ; preds = %cond_false1046
br bool false, label %bb1078, label %bb1077
br i1 false, label %bb1078, label %bb1077
bb1077: ; preds = %cond_next1061, %cond_false1046
br label %bb1078
bb1078: ; preds = %bb1077, %cond_next1061
%tmp1080 = phi bool [ true, %bb1077 ], [ false, %cond_next1061 ] ; <bool> [#uses=1]
br bool %tmp1080, label %cond_false1159, label %cond_true1081
%tmp1080 = phi i1 [ true, %bb1077 ], [ false, %cond_next1061 ] ; <i1> [#uses=1]
br i1 %tmp1080, label %cond_false1159, label %cond_true1081
cond_true1081: ; preds = %bb1078
br bool false, label %cond_true1110, label %cond_false1117
br i1 false, label %cond_true1110, label %cond_false1117
cond_true1110: ; preds = %cond_true1081
br label %bb1269.outer.outer.outer.outer.backedge
@ -338,32 +334,32 @@ bb1269.outer.outer.outer.outer.backedge: ; preds = %cond_true1131, %cond_true11
br label %bb1269.outer.outer.outer.outer
cond_false1117: ; preds = %cond_true1081
br bool false, label %cond_true1131, label %cond_false1138
br i1 false, label %cond_true1131, label %cond_false1138
cond_true1131: ; preds = %cond_false1117
br label %bb1269.outer.outer.outer.outer.backedge
cond_false1138: ; preds = %cond_false1117
br bool false, label %UnifiedReturnBlock, label %cond_false1153
br i1 false, label %UnifiedReturnBlock, label %cond_false1153
cond_false1153: ; preds = %cond_false1138
br label %UnifiedUnreachableBlock
cond_false1159: ; preds = %bb1078
%tmp.i119.lcssa35.lcssa.lcssa.lcssa.lcssa.lcssa = phi "struct.kc::impl_elem_patternrepresentation"* [ null, %bb1078 ] ; <"struct.kc::impl_elem_patternrepresentation"*> [#uses=0]
br bool false, label %UnifiedReturnBlock, label %cond_false1174
%tmp.i119.lcssa35.lcssa.lcssa.lcssa.lcssa.lcssa = phi %"struct.kc::impl_elem_patternrepresentation"* [ null, %bb1078 ] ; <%"struct.kc::impl_elem_patternrepresentation"*> [#uses=0]
br i1 false, label %UnifiedReturnBlock, label %cond_false1174
cond_false1174: ; preds = %cond_false1159
br bool false, label %UnifiedReturnBlock, label %cond_false1189
br i1 false, label %UnifiedReturnBlock, label %cond_false1189
cond_false1189: ; preds = %cond_false1174
br bool false, label %UnifiedReturnBlock, label %cond_false1204
br i1 false, label %UnifiedReturnBlock, label %cond_false1204
cond_false1204: ; preds = %cond_false1189
br bool false, label %UnifiedReturnBlock, label %cond_false1219
br i1 false, label %UnifiedReturnBlock, label %cond_false1219
cond_false1219: ; preds = %cond_false1204
br bool false, label %UnifiedReturnBlock, label %cond_true1222
br i1 false, label %UnifiedReturnBlock, label %cond_true1222
cond_true1222: ; preds = %cond_false1219
br label %UnifiedReturnBlock
@ -396,22 +392,22 @@ bb1269.outer69: ; preds = %bb1269.outer54, %cond_true
br label %bb1269
bb1269: ; preds = %bb1269.outer69
br bool false, label %cond_next1281, label %bb1294
br i1 false, label %cond_next1281, label %bb1294
cond_next1281: ; preds = %bb1269
br bool false, label %cond_true1298, label %bb1294
br i1 false, label %cond_true1298, label %bb1294
bb1294: ; preds = %cond_next1281, %bb1269
br bool false, label %cond_true1331, label %cond_next1313
br i1 false, label %cond_true1331, label %cond_next1313
cond_true1298: ; preds = %cond_next1281
br bool false, label %cond_false, label %cond_true
br i1 false, label %cond_false, label %cond_true
cond_next1313: ; preds = %bb1294
br bool false, label %cond_true1331, label %cond_next1355
br i1 false, label %cond_true1331, label %cond_next1355
cond_true1331: ; preds = %cond_next1313, %bb1294
br bool false, label %cond_false1346, label %cond_true1342
br i1 false, label %cond_false1346, label %cond_true1342
cond_true1342: ; preds = %cond_true1331
br label %cond_next1350
@ -423,37 +419,37 @@ cond_next1350: ; preds = %cond_false1346, %cond_true1342
br label %bb.i
bb.i: ; preds = %bb.i, %cond_next1350
br bool false, label %_ZN2kc18impl_abstract_list8freelistEv.exit, label %bb.i
br i1 false, label %_ZN2kc18impl_abstract_list8freelistEv.exit, label %bb.i
_ZN2kc18impl_abstract_list8freelistEv.exit: ; preds = %bb.i
br label %cond_next1355
cond_next1355: ; preds = %_ZN2kc18impl_abstract_list8freelistEv.exit, %cond_next1313
br bool false, label %cond_next1363, label %bb1388
br i1 false, label %cond_next1363, label %bb1388
cond_next1363: ; preds = %cond_next1355
br bool false, label %UnifiedReturnBlock, label %cond_true1366
br i1 false, label %UnifiedReturnBlock, label %cond_true1366
cond_true1366: ; preds = %cond_next1363
br label %UnifiedReturnBlock
bb1388: ; preds = %cond_next1355
br bool false, label %UnifiedReturnBlock, label %bb1414.preheader
br i1 false, label %UnifiedReturnBlock, label %bb1414.preheader
bb1414.preheader: ; preds = %bb1388
br label %bb1414
bb1414: ; preds = %cond_true1426, %bb1414.preheader
br bool false, label %cond_true1426, label %bb1429
br i1 false, label %cond_true1426, label %bb1429
cond_true1426: ; preds = %bb1414
br label %bb1414
bb1429: ; preds = %bb1414
br bool false, label %cond_true1431, label %UnifiedReturnBlock
br i1 false, label %cond_true1431, label %UnifiedReturnBlock
cond_true1431: ; preds = %bb1429
br bool false, label %UnifiedReturnBlock, label %cond_true1434
br i1 false, label %UnifiedReturnBlock, label %cond_true1434
cond_true1434: ; preds = %cond_true1431
br label %UnifiedReturnBlock

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,27 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -condprop | llvm-dis | \
; RUN: llvm-as < %s | opt -condprop | llvm-dis | \
; RUN: not grep {br label}
int %test(bool %C) {
br bool %C, label %T1, label %F1
T1:
br label %Cont
F1:
br label %Cont
Cont:
%C2 = phi bool [false, %F1], [true, %T1]
br bool %C2, label %T2, label %F2
T2:
call void %bar()
ret int 17
F2:
ret int 1
define i32 @test(i1 %C) {
br i1 %C, label %T1, label %F1
T1: ; preds = %0
br label %Cont
F1: ; preds = %0
br label %Cont
Cont: ; preds = %F1, %T1
%C2 = phi i1 [ false, %F1 ], [ true, %T1 ] ; <i1> [#uses=1]
br i1 %C2, label %T2, label %F2
T2: ; preds = %Cont
call void @bar( )
ret i32 17
F2: ; preds = %Cont
ret i32 1
}
declare void %bar()
declare void @bar()

View File

@ -1,33 +1,43 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -condprop | llvm-dis | not grep phi
; RUN: llvm-as < %s | opt -condprop | llvm-dis | not grep phi
int %test(uint %C, bool %Val) {
switch uint %C, label %T1 [
uint 4, label %T2
uint 17, label %T3
define i32 @test(i32 %C, i1 %Val) {
switch i32 %C, label %T1 [
i32 4, label %T2
i32 17, label %T3
]
T1:
call void %a()
br label %Cont
T2:
call void %b()
br label %Cont
T3:
call void %c()
br label %Cont
Cont:
;; PHI becomes dead after threading T2
%C2 = phi bool [%Val, %T1], [true, %T2], [%Val, %T3]
br bool %C2, label %L2, label %F2
L2:
call void %d()
ret int 17
F2:
call void %e()
ret int 1
T1: ; preds = %0
call void @a( )
br label %Cont
T2: ; preds = %0
call void @b( )
br label %Cont
T3: ; preds = %0
call void @c( )
br label %Cont
Cont: ; preds = %T3, %T2, %T1
;; PHI becomes dead after threading T2
%C2 = phi i1 [ %Val, %T1 ], [ true, %T2 ], [ %Val, %T3 ] ; <i1> [#uses=1]
br i1 %C2, label %L2, label %F2
L2: ; preds = %Cont
call void @d( )
ret i32 17
F2: ; preds = %Cont
call void @e( )
ret i32 1
}
declare void %a()
declare void %b()
declare void %c()
declare void %d()
declare void %e()
declare void @a()
declare void @b()
declare void @c()
declare void @d()
declare void @e()

View File

@ -1,36 +1,46 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -condprop | llvm-dis | not grep phi
; RUN: llvm-as < %s | opt -condprop | llvm-dis | not grep phi
declare bool %foo()
declare i1 @foo()
int %test(uint %C) {
%Val = call bool %foo()
switch uint %C, label %T1 [
uint 4, label %T2
uint 17, label %T3
define i32 @test(i32 %C) {
%Val = call i1 @foo( ) ; <i1> [#uses=2]
switch i32 %C, label %T1 [
i32 4, label %T2
i32 17, label %T3
]
T1:
call void %a()
br label %Cont
T2:
call void %b()
br label %Cont
T3:
call void %c()
br label %Cont
Cont:
;; PHI becomes dead after threading T2
%C2 = phi bool [%Val, %T1], [true, %T2], [%Val, %T3]
br bool %C2, label %L2, label %F2
L2:
call void %d()
ret int 17
F2:
call void %e()
ret int 1
T1: ; preds = %0
call void @a( )
br label %Cont
T2: ; preds = %0
call void @b( )
br label %Cont
T3: ; preds = %0
call void @c( )
br label %Cont
Cont: ; preds = %T3, %T2, %T1
;; PHI becomes dead after threading T2
%C2 = phi i1 [ %Val, %T1 ], [ true, %T2 ], [ %Val, %T3 ] ; <i1> [#uses=1]
br i1 %C2, label %L2, label %F2
L2: ; preds = %Cont
call void @d( )
ret i32 17
F2: ; preds = %Cont
call void @e( )
ret i32 1
}
declare void %a()
declare void %b()
declare void %c()
declare void %d()
declare void %e()
declare void @a()
declare void @b()
declare void @c()
declare void @d()
declare void @e()

View File

@ -1,14 +1,15 @@
; Make sure that the constant propogator doesn't divide by zero!
;
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop
; RUN: llvm-as < %s | opt -constprop
;
int "test"() {
%R = div int 12, 0
ret int %R
define i32 @test() {
%R = sdiv i32 12, 0 ; <i32> [#uses=1]
ret i32 %R
}
int "test2"() {
%R = rem int 12, 0
ret int %R
define i32 @test2() {
%R = srem i32 12, 0 ; <i32> [#uses=1]
ret i32 %R
}

View File

@ -4,15 +4,16 @@
; Fix #2: The unary not instruction now no longer exists. Change to xor.
; RUN: llvm-upgrade < $test | llvm-as | opt -constprop | llvm-dis | \
; RUN: not grep {int 0}
; RUN: llvm-as < $test | opt -constprop | llvm-dis | \
; RUN: not grep {i32 0}
int "test1"() {
%R = xor int 123, -1
ret int %R
define i32 @test1() {
%R = xor i32 123, -1 ; <i32> [#uses=1]
ret i32 %R
}
int "test2"() {
%R = xor int -123, -1
ret int %R
define i32 @test2() {
%R = xor i32 -123, -1 ; <i32> [#uses=1]
ret i32 %R
}

View File

@ -1,20 +1,20 @@
; SetCC on boolean values was not implemented!
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -die | llvm-dis | \
; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | \
; RUN: not grep set
bool "test1"() {
%A = setle bool true, false
%B = setge bool true, false
%C = setlt bool false, true
%D = setgt bool true, false
%E = seteq bool false, false
%F = setne bool false, true
%G = and bool %A, %B
%H = and bool %C, %D
%I = and bool %E, %F
%J = and bool %G, %H
%K = and bool %I, %J
ret bool %K
define i1 @test1() {
%A = icmp ule i1 true, false ; <i1> [#uses=1]
%B = icmp uge i1 true, false ; <i1> [#uses=1]
%C = icmp ult i1 false, true ; <i1> [#uses=1]
%D = icmp ugt i1 true, false ; <i1> [#uses=1]
%E = icmp eq i1 false, false ; <i1> [#uses=1]
%F = icmp ne i1 false, true ; <i1> [#uses=1]
%G = and i1 %A, %B ; <i1> [#uses=1]
%H = and i1 %C, %D ; <i1> [#uses=1]
%I = and i1 %E, %F ; <i1> [#uses=1]
%J = and i1 %G, %H ; <i1> [#uses=1]
%K = and i1 %I, %J ; <i1> [#uses=1]
ret i1 %K
}

View File

@ -1,15 +1,15 @@
; Make sure that the constant propagator doesn't cause a sigfpe
;
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop
; RUN: llvm-as < %s | opt -constprop
;
int "test"() {
%R = div int -2147483648, -1
ret int %R
define i32 @test() {
%R = sdiv i32 -2147483648, -1 ; <i32> [#uses=1]
ret i32 %R
}
int "test2"() {
%R = rem int -2147483648, -1
ret int %R
define i32 @test2() {
%R = srem i32 -2147483648, -1 ; <i32> [#uses=1]
ret i32 %R
}

View File

@ -1,13 +1,10 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | \
; RUN: not grep {ret bool false}
; RUN: llvm-as < %s | opt -constprop | llvm-dis | \
; RUN: not grep {ret i1 false}
%b = external global [2 x { }]
@b = external global [2 x { }] ; <[2 x { }]*> [#uses=2]
implementation
bool %f() {
; tmp.2 -> true, not false.
%tmp.2 = seteq { }* getelementptr ([2 x { }]* %b, int 0, int 0),
getelementptr ([2 x { }]* %b, int 0, int 1)
ret bool %tmp.2
define i1 @f() {
%tmp.2 = icmp eq { }* getelementptr ([2 x { }]* @b, i32 0, i32 0), getelementptr ([2 x { }]* @b, i32 0, i32 1) ; <i1> [#uses=1]
ret i1 %tmp.2
}

View File

@ -1,9 +1,10 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | \
; RUN: llvm-as < %s | opt -constprop | llvm-dis | \
; RUN: grep {i32 -1}
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | \
; RUN: llvm-as < %s | opt -constprop | llvm-dis | \
; RUN: not grep zeroinitializer
< 4 x uint> %test() {
%tmp40 = bitcast <2 x long> bitcast (<4 x int> < int 0, int 0, int -1, int 0 > to <2 x long>) to <4 x uint>
ret <4 x uint> %tmp40
define <4 x i32> @test() {
%tmp40 = bitcast <2 x i64> bitcast (<4 x i32> < i32 0, i32 0, i32 -1, i32 0 > to <2 x i64>) to <4 x i32>; <<4 x i32>> [#uses=1]
ret <4 x i32> %tmp40
}

View File

@ -1,6 +1,7 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
; RUN: grep {ret i1 false}
bool %test() {
%X = trunc uint 320 to bool
ret bool %X
define i1 @test() {
%X = trunc i32 320 to i1 ; <i1> [#uses=1]
ret i1 %X
}

View File

@ -1,15 +1,15 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | \
; RUN: llvm-as < %s | opt -constprop | llvm-dis | \
; RUN: grep {ret i32 -1}
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | \
; RUN: llvm-as < %s | opt -constprop | llvm-dis | \
; RUN: grep {ret i32 1}
int %test1() {
%A = sext bool true to int
ret int %A
define i32 @test1() {
%A = sext i1 true to i32 ; <i32> [#uses=1]
ret i32 %A
}
uint %test2() {
%A = zext bool true to uint
ret uint %A
define i32 @test2() {
%A = zext i1 true to i32 ; <i32> [#uses=1]
ret i32 %A
}

View File

@ -1,16 +1,20 @@
; This is a basic sanity check for constant propogation. The add instruction
; should be eliminated.
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -die | llvm-dis | not grep add
; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not grep add
int %test(bool %B) {
br bool %B, label %BB1, label %BB2
BB1:
%Val = add int 0, 0
br label %BB3
BB2:
br label %BB3
BB3:
%Ret = phi int [%Val, %BB1], [1, %BB2]
ret int %Ret
define i32 @test(i1 %B) {
br i1 %B, label %BB1, label %BB2
BB1: ; preds = %0
%Val = add i32 0, 0 ; <i32> [#uses=1]
br label %BB3
BB2: ; preds = %0
br label %BB3
BB3: ; preds = %BB2, %BB1
%Ret = phi i32 [ %Val, %BB1 ], [ 1, %BB2 ] ; <i32> [#uses=1]
ret i32 %Ret
}

View File

@ -1,3 +1,2 @@
; RUN: llvm-upgrade < %s | llvm-as | llvm-dis | grep 0x36A0000000000000
%A = global float bitcast (int 1 to float)
; RUN: llvm-as < %s | llvm-dis | grep 0x36A0000000000000
@A = global float 0x36A0000000000000 ; <float*> [#uses=0]

View File

@ -1,22 +1,25 @@
; bswap should be constant folded when it is passed a constant argument
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | not grep call
; RUN: llvm-as < %s | opt -constprop | llvm-dis | not grep call
declare ushort %llvm.bswap.i16(ushort)
declare uint %llvm.bswap.i32(uint)
declare ulong %llvm.bswap.i64(ulong)
declare i16 @llvm.bswap.i16(i16)
ushort %W() {
%Z = call ushort %llvm.bswap.i16(ushort 1)
ret ushort %Z
declare i32 @llvm.bswap.i32(i32)
declare i64 @llvm.bswap.i64(i64)
define i16 @W() {
%Z = call i16 @llvm.bswap.i16( i16 1 ) ; <i16> [#uses=1]
ret i16 %Z
}
uint %X() {
%Z = call uint %llvm.bswap.i32(uint 1)
ret uint %Z
define i32 @X() {
%Z = call i32 @llvm.bswap.i32( i32 1 ) ; <i32> [#uses=1]
ret i32 %Z
}
ulong %Y() {
%Z = call ulong %llvm.bswap.i64(ulong 1)
ret ulong %Z
define i64 @Y() {
%Z = call i64 @llvm.bswap.i64( i64 1 ) ; <i64> [#uses=1]
ret i64 %Z
}

View File

@ -1,25 +1,30 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | not grep call
; RUN: llvm-as < %s | opt -constprop | llvm-dis | not grep call
declare double %cos(double)
declare double %sin(double)
declare double %tan(double)
declare double %sqrt(double)
declare bool %llvm.isunordered.f64(double, double)
declare double @cos(double)
double %T() {
%A = call double %cos(double 0.0)
%B = call double %sin(double 0.0)
%a = add double %A, %B
%C = call double %tan(double 0.0)
%b = add double %a, %C
%D = call double %sqrt(double 4.0)
%c = add double %b, %D
ret double %c
declare double @sin(double)
declare double @tan(double)
declare double @sqrt(double)
declare i1 @llvm.isunordered.f64(double, double)
define double @T() {
%A = call double @cos( double 0.000000e+00 ) ; <double> [#uses=1]
%B = call double @sin( double 0.000000e+00 ) ; <double> [#uses=1]
%a = add double %A, %B ; <double> [#uses=1]
%C = call double @tan( double 0.000000e+00 ) ; <double> [#uses=1]
%b = add double %a, %C ; <double> [#uses=1]
%D = call double @sqrt( double 4.000000e+00 ) ; <double> [#uses=1]
%c = add double %b, %D ; <double> [#uses=1]
ret double %c
}
bool %TNAN() {
%A = call bool %llvm.isunordered.f64(double 0x7FF8000000000000, double 1.0) ;; it's a nan!
%B = call bool %llvm.isunordered.f64(double 123.0, double 1.0)
%C = or bool %A, %B
ret bool %C
define i1 @TNAN() {
%A = fcmp uno double 0x7FF8000000000000, 1.000000e+00 ; <i1> [#uses=1]
%B = fcmp uno double 1.230000e+02, 1.000000e+00 ; <i1> [#uses=1]
%C = or i1 %A, %B ; <i1> [#uses=1]
ret i1 %C
}

View File

@ -1,11 +1,12 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | \
; RUN: llvm-as < %s | opt -constprop | llvm-dis | \
; RUN: grep -F {ret i32* null} | count 2
int* %test1() {
%X = cast float 0.0 to int*
ret int* %X
define i32* @test1() {
%X = inttoptr i64 0 to i32* ; <i32*> [#uses=1]
ret i32* %X
}
int* %test2() {
ret int* cast (float 0.0 to int*)
define i32* @test2() {
ret i32* null
}

View File

@ -1,14 +1,35 @@
; Ensure constant propogation of logical instructions is working correctly.
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -die | llvm-dis | \
; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | \
; RUN: not egrep {and|or|xor}
define i32 @test1() {
%R = and i32 4, 1234 ; <i32> [#uses=1]
ret i32 %R
}
int "test1"() { %R = and int 4,1234 ret int %R }
bool "test1"() { %R = and bool true, false ret bool %R }
define i1 @test1.upgrd.1() {
%R = and i1 true, false ; <i1> [#uses=1]
ret i1 %R
}
int "test2"() { %R = or int 4,1234 ret int %R }
bool "test2"() { %R = or bool true, false ret bool %R }
define i32 @test2() {
%R = or i32 4, 1234 ; <i32> [#uses=1]
ret i32 %R
}
define i1 @test2.upgrd.2() {
%R = or i1 true, false ; <i1> [#uses=1]
ret i1 %R
}
define i32 @test3() {
%R = xor i32 4, 1234 ; <i32> [#uses=1]
ret i32 %R
}
define i1 @test3.upgrd.3() {
%R = xor i1 true, false ; <i1> [#uses=1]
ret i1 %R
}
int "test3"() { %R = xor int 4,1234 ret int %R }
bool "test3"() { %R = xor bool true, false ret bool %R }

View File

@ -1,19 +1,19 @@
; Ensure constant propogation of 'not' instructions is working correctly.
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -die | llvm-dis | not grep xor
; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not grep xor
int "test1"() {
%R = xor int 4, -1
ret int %R
define i32 @test1() {
%R = xor i32 4, -1 ; <i32> [#uses=1]
ret i32 %R
}
int "test2"() {
%R = xor int -23, -1
ret int %R
define i32 @test2() {
%R = xor i32 -23, -1 ; <i32> [#uses=1]
ret i32 %R
}
bool "test3"() {
%R = xor bool true, true
ret bool %R
define i1 @test3() {
%R = xor i1 true, true ; <i1> [#uses=1]
ret i1 %R
}

View File

@ -1,14 +1,17 @@
; This is a basic sanity check for constant propogation. The add instruction
; should be eliminated.
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -die | llvm-dis | not grep phi
; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not grep phi
int %test(bool %B) {
define i32 @test(i1 %B) {
BB0:
br bool %B, label %BB1, label %BB3
BB1:
br label %BB3
BB3:
%Ret = phi int [1, %BB0], [1, %BB1]
ret int %Ret
br i1 %B, label %BB1, label %BB3
BB1: ; preds = %BB0
br label %BB3
BB3: ; preds = %BB1, %BB0
%Ret = phi i32 [ 1, %BB0 ], [ 1, %BB1 ] ; <i32> [#uses=1]
ret i32 %Ret
}

View File

@ -1,23 +1,24 @@
; Ensure constant propagation of remainder instructions is working correctly.
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -die | llvm-dis | not grep rem
; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not grep rem
int %test1() {
%R = rem int 4, 3
ret int %R
define i32 @test1() {
%R = srem i32 4, 3 ; <i32> [#uses=1]
ret i32 %R
}
int %test2() {
%R = rem int 123, -23
ret int %R
define i32 @test2() {
%R = srem i32 123, -23 ; <i32> [#uses=1]
ret i32 %R
}
float %test3() {
%R = rem float 0x4028E66660000000, 0x405ECDA1C0000000
ret float %R
define float @test3() {
%R = frem float 0x4028E66660000000, 0x405ECDA1C0000000 ; <float> [#uses=1]
ret float %R
}
double %test4() {
%R = rem double 0x4073833BEE07AFF8, 0x4028AAABB2A0D19C
ret double %R
define double @test4() {
%R = frem double 0x4073833BEE07AFF8, 0x4028AAABB2A0D19C ; <double> [#uses=1]
ret double %R
}

View File

@ -1,14 +1,13 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -constmerge > /dev/null
; RUN: llvm-as < %s | opt -constmerge > /dev/null
%foo = internal constant {int} {int 7}
%bar = internal constant {int} {int 7}
@foo.upgrd.1 = internal constant { i32 } { i32 7 } ; <{ i32 }*> [#uses=1]
@bar = internal constant { i32 } { i32 7 } ; <{ i32 }*> [#uses=1]
implementation
declare i32 @test(i32*)
declare int %test(int*)
void %foo() {
call int %test(int* getelementptr ( {int} * %foo, long 0, uint 0))
call int %test(int* getelementptr ( {int} * %bar, long 0, uint 0))
ret void
define void @foo() {
call i32 @test( i32* getelementptr ({ i32 }* @foo.upgrd.1, i64 0, i32 0) ) ; <i32>:1 [#uses=0]
call i32 @test( i32* getelementptr ({ i32 }* @bar, i64 0, i32 0) ) ; <i32>:2 [#uses=0]
ret void
}

View File

@ -1,7 +1,5 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -constmerge | llvm-dis | %prcontext foo 2 | grep bar
; RUN: llvm-as < %s | opt -constmerge | llvm-dis | %prcontext foo 2 | grep bar
%foo = constant int 6
%bar = constant int 6
implementation
@foo = constant i32 6 ; <i32*> [#uses=0]
@bar = constant i32 6 ; <i32*> [#uses=0]

View File

@ -1,15 +1,16 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -constmerge | llvm-dis | grep foo
; RUN: llvm-upgrade < %s | llvm-as | opt -constmerge | llvm-dis | grep bar
; RUN: llvm-as < %s | opt -constmerge | llvm-dis | grep foo
; RUN: llvm-as < %s | opt -constmerge | llvm-dis | grep bar
; Don't merge constants in different sections.
%G1 = internal constant int 1, section "foo"
%G2 = internal constant int 1, section "bar"
%G3 = internal constant int 1, section "bar"
@G1 = internal constant i32 1, section "foo" ; <i32*> [#uses=1]
@G2 = internal constant i32 1, section "bar" ; <i32*> [#uses=1]
@G3 = internal constant i32 1, section "bar" ; <i32*> [#uses=1]
void %test(int** %P1, int **%P2, int **%P3) {
store int* %G1, int** %P1
store int* %G2, int** %P2
store int* %G3, int** %P3
ret void
define void @test(i32** %P1, i32** %P2, i32** %P3) {
store i32* @G1, i32** %P1
store i32* @G2, i32** %P2
store i32* @G3, i32** %P3
ret void
}

View File

@ -1,13 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -deadargelim -disable-output
; RUN: llvm-as < %s | opt -deadargelim -disable-output
implementation
internal csretcc void %build_delaunay({int}* %agg.result) {
ret void
define internal void @build_delaunay({ i32 }* sret %agg.result) {
ret void
}
void %test() {
call csretcc void %build_delaunay({int}* null)
ret void
define void @test() {
call void @build_delaunay( { i32 }* sret null )
ret void
}

View File

@ -1,37 +1,36 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -deadargelim | llvm-dis | not grep DEADARG
implementation
; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep DEADARG
; test - an obviously dead argument
internal int %test(int %v, int %DEADARG1, int* %p) {
store int %v, int* %p
ret int %v
define internal i32 @test(i32 %v, i32 %DEADARG1, i32* %p) {
store i32 %v, i32* %p
ret i32 %v
}
; hardertest - an argument which is only used by a call of a function with a
; dead argument.
internal int %hardertest(int %DEADARG2) {
%p = alloca int
%V = call int %test(int 5, int %DEADARG2, int* %p)
ret int %V
define internal i32 @hardertest(i32 %DEADARG2) {
%p = alloca i32 ; <i32*> [#uses=1]
%V = call i32 @test( i32 5, i32 %DEADARG2, i32* %p ) ; <i32> [#uses=1]
ret i32 %V
}
; evenhardertest - recursive dead argument...
internal void %evenhardertest(int %DEADARG3) {
call void %evenhardertest(int %DEADARG3)
ret void
define internal void @evenhardertest(i32 %DEADARG3) {
call void @evenhardertest( i32 %DEADARG3 )
ret void
}
internal void %needarg(int %TEST) {
call int %needarg2(int %TEST)
ret void
define internal void @needarg(i32 %TEST) {
call i32 @needarg2( i32 %TEST ) ; <i32>:1 [#uses=0]
ret void
}
internal int %needarg2(int %TEST) {
ret int %TEST
define internal i32 @needarg2(i32 %TEST) {
ret i32 %TEST
}
internal void %needarg3(int %TEST3) {
call void %needarg(int %TEST3)
ret void
define internal void @needarg3(i32 %TEST3) {
call void @needarg( i32 %TEST3 )
ret void
}

View File

@ -1,12 +1,12 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -deadargelim | llvm-dis | not grep 47
; RUN: llvm-upgrade < %s | llvm-as | opt -deadargelim | llvm-dis | not grep 1.0
; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep 47
; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep 1.0
int %bar(int %A) {
%tmp4 = tail call int (int, ...)* %foo( int %A, int %A, int %A, int %A, ulong 47, double 1.000000e+00 )
ret int %tmp4
define i32 @bar(i32 %A) {
%tmp4 = tail call i32 (i32, ...)* @foo( i32 %A, i32 %A, i32 %A, i32 %A, i64 47, double 1.000000e+00 ) ; <i32> [#uses=1]
ret i32 %tmp4
}
internal int %foo(int %X, ...) {
ret int %X
define internal i32 @foo(i32 %X, ...) {
ret i32 %X
}

View File

@ -1,19 +1,18 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -deadargelim | llvm-dis | not grep DEAD
; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep DEAD
implementation
internal int %test(int %DEADARG) { ; Dead arg only used by dead retval
ret int %DEADARG
; Dead arg only used by dead retval
define internal i32 @test(i32 %DEADARG) {
ret i32 %DEADARG
}
int %test2(int %A) {
%DEAD = call int %test(int %A)
ret int 123
define i32 @test2(i32 %A) {
%DEAD = call i32 @test( i32 %A ) ; <i32> [#uses=0]
ret i32 123
}
int %test3() {
%X = call int %test2(int 3232)
%Y = add int %X, -123
ret int %Y
define i32 @test3() {
%X = call i32 @test2( i32 3232 ) ; <i32> [#uses=1]
%Y = add i32 %X, -123 ; <i32> [#uses=1]
ret i32 %Y
}

View File

@ -1,36 +1,33 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -deadargelim -die | llvm-dis | not grep DEAD
; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis | not grep DEAD
%P = external global int
@P = external global i32 ; <i32*> [#uses=1]
implementation
internal int %test(int %DEADARG) { ; Dead arg only used by dead retval
ret int %DEADARG
; Dead arg only used by dead retval
define internal i32 @test(i32 %DEADARG) {
ret i32 %DEADARG
}
internal int %test2(int %DEADARG) {
%DEADRETVAL = call int %test(int %DEADARG)
ret int %DEADRETVAL
define internal i32 @test2(i32 %DEADARG) {
%DEADRETVAL = call i32 @test( i32 %DEADARG ) ; <i32> [#uses=1]
ret i32 %DEADRETVAL
}
void %test3(int %X) {
%DEADRETVAL = call int %test2(int %X)
ret void
define void @test3(i32 %X) {
%DEADRETVAL = call i32 @test2( i32 %X ) ; <i32> [#uses=0]
ret void
}
internal int %foo() {
%DEAD = load int* %P
ret int %DEAD
define internal i32 @foo() {
%DEAD = load i32* @P ; <i32> [#uses=1]
ret i32 %DEAD
}
internal int %id(int %X) {
ret int %X
define internal i32 @id(i32 %X) {
ret i32 %X
}
void %test4() {
%DEAD = call int %foo()
%DEAD2 = call int %id(int %DEAD)
ret void
define void @test4() {
%DEAD = call i32 @foo( ) ; <i32> [#uses=1]
%DEAD2 = call i32 @id( i32 %DEAD ) ; <i32> [#uses=0]
ret void
}

View File

@ -1,14 +1,14 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -dse -scalarrepl -instcombine | \
; RUN: llvm-as < %s | opt -dse -scalarrepl -instcombine | \
; RUN: llvm-dis | not grep {ret int undef}
int %test(double %__x) {
%__u = alloca { [3 x int] }
%tmp.1 = cast { [3 x int] }* %__u to double*
store double %__x, double* %tmp.1
%tmp.4 = getelementptr { [3 x int] }* %__u, int 0, uint 0, int 1
%tmp.5 = load int* %tmp.4
%tmp.6 = setlt int %tmp.5, 0
%tmp.7 = cast bool %tmp.6 to int
ret int %tmp.7
define i32 @test(double %__x) {
%__u = alloca { [3 x i32] } ; <{ [3 x i32] }*> [#uses=2]
%tmp.1 = bitcast { [3 x i32] }* %__u to double* ; <double*> [#uses=1]
store double %__x, double* %tmp.1
%tmp.4 = getelementptr { [3 x i32] }* %__u, i32 0, i32 0, i32 1 ; <i32*> [#uses=1]
%tmp.5 = load i32* %tmp.4 ; <i32> [#uses=1]
%tmp.6 = icmp slt i32 %tmp.5, 0 ; <i1> [#uses=1]
%tmp.7 = zext i1 %tmp.6 to i32 ; <i32> [#uses=1]
ret i32 %tmp.7
}

View File

@ -1,13 +1,13 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -dse | llvm-dis | \
; RUN: llvm-as < %s | opt -dse | llvm-dis | \
; RUN: grep {store i32 1234567}
; Do not delete stores that are only partially killed.
int %test() {
%V = alloca int
store int 1234567, int* %V
%V2 = cast int* %V to sbyte*
store sbyte 0, sbyte* %V2
%X = load int* %V
ret int %X
define i32 @test() {
%V = alloca i32 ; <i32*> [#uses=3]
store i32 1234567, i32* %V
%V2 = bitcast i32* %V to i8* ; <i8*> [#uses=1]
store i8 0, i8* %V2
%X = load i32* %V ; <i32> [#uses=1]
ret i32 %X
}

View File

@ -1,9 +1,9 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -dse | llvm-dis | grep store
; RUN: llvm-as < %s | opt -dse | llvm-dis | grep store
double %foo(sbyte* %X) {
%X_addr = alloca sbyte*
store sbyte* %X, sbyte** %X_addr ;; not a dead store.
%tmp.0 = va_arg sbyte** %X_addr, double
define double @foo(i8* %X) {
%X_addr = alloca i8* ; <i8**> [#uses=2]
store i8* %X, i8** %X_addr
%tmp.0 = va_arg i8** %X_addr, double ; <double> [#uses=1]
ret double %tmp.0
}

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,13 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -dse | llvm-dis | \
; RUN: llvm-as < %s | opt -dse | llvm-dis | \
; RUN: not grep {store i8}
; Ensure that the dead store is deleted in this case. It is wholely
; overwritten by the second store.
int %test() {
%V = alloca int
%V2 = cast int* %V to sbyte*
store sbyte 0, sbyte* %V2
store int 1234567, int* %V
%X = load int* %V
ret int %X
define i32 @test() {
%V = alloca i32 ; <i32*> [#uses=3]
%V2 = bitcast i32* %V to i8* ; <i8*> [#uses=1]
store i8 0, i8* %V2
store i32 1234567, i32* %V
%X = load i32* %V ; <i32> [#uses=1]
ret i32 %X
}

View File

@ -1,8 +1,9 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -dse | llvm-dis | not grep DEAD
; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
void %test(int* %Q) {
%P = alloca int
%DEAD = load int* %Q
store int %DEAD, int* %P ;; Alloca goes out of scope, dead store.
ret void
define void @test(i32* %Q) {
%P = alloca i32 ; <i32*> [#uses=1]
%DEAD = load i32* %Q ; <i32> [#uses=1]
store i32 %DEAD, i32* %P
ret void
}

View File

@ -1,15 +1,14 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -dse | llvm-dis | not grep DEAD
; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
declare void %ext()
declare void @ext()
int* %caller() {
%P = malloc int
%DEAD = load int* %P
%DEAD2 = add int %DEAD, 1
store int %DEAD2, int* %P ;; dead store
call void %ext() ; Can not clobber *P
store int 0, int* %P
ret int* %P
define i32* @caller() {
%P = malloc i32 ; <i32*> [#uses=4]
%DEAD = load i32* %P ; <i32> [#uses=1]
%DEAD2 = add i32 %DEAD, 1 ; <i32> [#uses=1]
store i32 %DEAD2, i32* %P
call void @ext( )
store i32 0, i32* %P
ret i32* %P
}

View File

@ -1,8 +1,8 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -dse | llvm-dis | not grep DEAD
; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
void %test(int* %Q, int* %P) {
%DEAD = load int* %Q
store int %DEAD, int* %P
free int* %P
ret void
define void @test(i32* %Q, i32* %P) {
%DEAD = load i32* %Q ; <i32> [#uses=1]
store i32 %DEAD, i32* %P
free i32* %P
ret void
}

View File

@ -1,8 +1,9 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -dse | llvm-dis | not grep DEAD
; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
void %test(int* %Q, int* %P) {
%DEAD = load int* %Q
store int %DEAD, int* %P
store int 0, int* %P
ret void
define void @test(i32* %Q, i32* %P) {
%DEAD = load i32* %Q ; <i32> [#uses=1]
store i32 %DEAD, i32* %P
store i32 0, i32* %P
ret void
}

View File

@ -1,18 +1,17 @@
; This entire chain of computation should be optimized away, but
; wasn't because the two multiplies were not detected as being identical.
;
; RUN: llvm-upgrade < %s | llvm-as | opt -gcse -instcombine -dce | \
; RUN: llvm-as < %s | opt -gcse -instcombine -dce | \
; RUN: llvm-dis | not grep sub
implementation ; Functions:
uint "vnum_test4"(uint* %data) {
%idx1 = getelementptr uint* %data, uint 1
%idx2 = getelementptr uint* %data, uint 3
%reg1101 = load uint* %idx1
%reg1111 = load uint* %idx2
%reg109 = mul uint %reg1101, %reg1111
%reg108 = mul uint %reg1111, %reg1101
%reg121 = sub uint %reg108, %reg109
ret uint %reg121
define i32 @vnum_test4(i32* %data) {
%idx1 = getelementptr i32* %data, i64 1 ; <i32*> [#uses=1]
%idx2 = getelementptr i32* %data, i64 3 ; <i32*> [#uses=1]
%reg1101 = load i32* %idx1 ; <i32> [#uses=2]
%reg1111 = load i32* %idx2 ; <i32> [#uses=2]
%reg109 = mul i32 %reg1101, %reg1111 ; <i32> [#uses=1]
%reg108 = mul i32 %reg1111, %reg1101 ; <i32> [#uses=1]
%reg121 = sub i32 %reg108, %reg109 ; <i32> [#uses=1]
ret i32 %reg121
}

View File

@ -1,13 +1,14 @@
; This testcase shows a bug where an common subexpression exists, but there
; is no shared dominator block that the expression can be hoisted out to.
;
; RUN: llvm-upgrade < %s | llvm-as | opt -gcse | llvm-dis
; RUN: llvm-as < %s | opt -gcse | llvm-dis
int "test"(int %X, int %Y) {
%Z = add int %X, %Y
ret int %Z
define i32 @test(i32 %X, i32 %Y) {
%Z = add i32 %X, %Y ; <i32> [#uses=1]
ret i32 %Z
Unreachable:
%Q = add int %X, %Y
ret int %Q
Unreachable: ; No predecessors!
%Q = add i32 %X, %Y ; <i32> [#uses=1]
ret i32 %Q
}

View File

@ -1,11 +1,11 @@
; This testcase shows a bug where an common subexpression exists, but there
; is no shared dominator block that the expression can be hoisted out to.
;
; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse | llvm-dis | not grep load
; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | not grep load
int %test(int* %P) {
store int 5, int* %P
%Z = load int* %P
ret int %Z
define i32 @test(i32* %P) {
store i32 5, i32* %P
%Z = load i32* %P ; <i32> [#uses=1]
ret i32 %Z
}

View File

@ -1,57 +1,46 @@
; Various test cases to ensure basic functionality is working for GCSE
; RUN: llvm-upgrade < %s | llvm-as | opt -gcse
implementation
void "testinsts"(int %i, int %j, int* %p)
begin
%A = cast int %i to uint
%B = cast int %i to uint
%C = shl int %i, ubyte 1
%D = shl int %i, ubyte 1
%E = getelementptr int* %p, long 12
%F = getelementptr int* %p, long 12
%G = getelementptr int* %p, long 13
ret void
end
; RUN: llvm-as < %s | opt -gcse
define void @testinsts(i32 %i, i32 %j, i32* %p) {
%A = bitcast i32 %i to i32 ; <i32> [#uses=0]
%B = bitcast i32 %i to i32 ; <i32> [#uses=0]
%C = shl i32 %i, 1 ; <i32> [#uses=0]
%D = shl i32 %i, 1 ; <i32> [#uses=0]
%E = getelementptr i32* %p, i64 12 ; <i32*> [#uses=0]
%F = getelementptr i32* %p, i64 12 ; <i32*> [#uses=0]
%G = getelementptr i32* %p, i64 13 ; <i32*> [#uses=0]
ret void
}
; Test different combinations of domination properties...
void "sameBBtest"(int %i, int %j)
begin
%A = add int %i, %j
%B = add int %i, %j
define void @sameBBtest(i32 %i, i32 %j) {
%A = add i32 %i, %j ; <i32> [#uses=1]
%B = add i32 %i, %j ; <i32> [#uses=1]
%C = xor i32 %A, -1 ; <i32> [#uses=0]
%D = xor i32 %B, -1 ; <i32> [#uses=0]
%E = xor i32 %j, -1 ; <i32> [#uses=0]
ret void
}
%C = xor int %A, -1
%D = xor int %B, -1
%E = xor int %j, -1
define i32 @dominates(i32 %i, i32 %j) {
%A = add i32 %i, %j ; <i32> [#uses=0]
br label %BB2
ret void
end
BB2: ; preds = %0
%B = add i32 %i, %j ; <i32> [#uses=1]
ret i32 %B
}
int "dominates"(int %i, int %j)
begin
%A = add int %i, %j
br label %BB2
define i32 @hascommondominator(i32 %i, i32 %j) {
br i1 true, label %BB1, label %BB2
BB2:
%B = add int %i, %j
ret int %B
end
BB1: ; preds = %0
%A = add i32 %i, %j ; <i32> [#uses=1]
ret i32 %A
int "hascommondominator"(int %i, int %j)
begin
br bool true, label %BB1, label %BB2
BB1:
%A = add int %i, %j
ret int %A
BB2:
%B = add int %i, %j
ret int %B
end
BB2: ; preds = %0
%B = add i32 %i, %j ; <i32> [#uses=1]
ret i32 %B
}

View File

@ -1,26 +1,24 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -gcse -instcombine | \
; RUN: llvm-as < %s | opt -gcse -instcombine | \
; RUN: llvm-dis | not grep sub
uint %test_extractelement(<4 x uint> %V) {
%R = extractelement <4 x uint> %V, uint 1
%R2 = extractelement <4 x uint> %V, uint 1
%V = sub uint %R, %R2
ret uint %V
define i32 @test_extractelement(<4 x i32> %V) {
%R = extractelement <4 x i32> %V, i32 1 ; <i32> [#uses=1]
%R2 = extractelement <4 x i32> %V, i32 1 ; <i32> [#uses=1]
%V.upgrd.1 = sub i32 %R, %R2 ; <i32> [#uses=1]
ret i32 %V.upgrd.1
}
<4 x uint> %test_insertelement(<4 x uint> %V) {
%R = insertelement <4 x uint> %V, uint 0, uint 0
%R2 = insertelement <4 x uint> %V, uint 0, uint 0
%x = sub <4 x uint> %R, %R2
ret <4 x uint> %x
define <4 x i32> @test_insertelement(<4 x i32> %V) {
%R = insertelement <4 x i32> %V, i32 0, i32 0 ; <<4 x i32>> [#uses=1]
%R2 = insertelement <4 x i32> %V, i32 0, i32 0 ; <<4 x i32>> [#uses=1]
%x = sub <4 x i32> %R, %R2 ; <<4 x i32>> [#uses=1]
ret <4 x i32> %x
}
<4 x uint> %test_shufflevector(<4 x uint> %V) {
%R = shufflevector <4 x uint> %V, <4 x uint> %V,
<4 x uint> < uint 1, uint undef, uint 7, uint 2>
%R2 = shufflevector <4 x uint> %V, <4 x uint> %V,
<4 x uint> < uint 1, uint undef, uint 7, uint 2>
%x = sub <4 x uint> %R, %R2
ret <4 x uint> %x
define <4 x i32> @test_shufflevector(<4 x i32> %V) {
%R = shufflevector <4 x i32> %V, <4 x i32> %V, <4 x i32> < i32 1, i32 undef, i32 7, i32 2 > ; <<4 x i32>> [#uses=1]
%R2 = shufflevector <4 x i32> %V, <4 x i32> %V, <4 x i32> < i32 1, i32 undef, i32 7, i32 2 > ; <<4 x i32>> [#uses=1]
%x = sub <4 x i32> %R, %R2 ; <<4 x i32>> [#uses=1]
ret <4 x i32> %x
}

View File

@ -1,12 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -globaldce
; RUN: llvm-as < %s | opt -globaldce
;
implementation
internal void %func() { ; Not dead, can be reachable via X
ret void
define internal void @func() {
ret void
}
void %main() {
%X = cast void()* %func to int*
ret void
define void @main() {
%X = bitcast void ()* @func to i32* ; <i32*> [#uses=0]
ret void
}

View File

@ -1,12 +1,13 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -globaldce
; RUN: llvm-as < %s | opt -globaldce
;
%X = global void() * %func
implementation
internal void %func() { ; Not dead, can be reachable via X
ret void
@X = global void ()* @func ; <void ()**> [#uses=0]
; Not dead, can be reachable via X
define internal void @func() {
ret void
}
void %main() {
ret void
define void @main() {
ret void
}

View File

@ -1,16 +1,17 @@
; Make sure that functions are removed successfully if they are referred to by
; a global that is dead. Make sure any globals they refer to die as well.
; RUN: llvm-upgrade < %s | llvm-as | opt -globaldce | llvm-dis | not grep foo
; RUN: llvm-as < %s | opt -globaldce | llvm-dis | not grep foo
%b = internal global int ()* %foo ;; Unused, kills %foo
;; Unused, kills %foo
@b = internal global i32 ()* @foo ; <i32 ()**> [#uses=0]
%foo = internal global int 7 ;; Should die when function %foo is killed
;; Should die when function %foo is killed
@foo.upgrd.1 = internal global i32 7 ; <i32*> [#uses=1]
implementation
internal int %foo() { ;; dies when %b dies.
%ret = load int* %foo
ret int %ret
;; dies when %b dies.
define internal i32 @foo() {
%ret = load i32* @foo.upgrd.1 ; <i32> [#uses=1]
ret i32 %ret
}

View File

@ -1,14 +1,12 @@
; This testcase tests that a worklist is being used, and that globals can be
; removed if they are the subject of a constexpr and ConstantPointerRef
; RUN: llvm-upgrade < %s | llvm-as | opt -globaldce | llvm-dis | not grep global
; RUN: llvm-as < %s | opt -globaldce | llvm-dis | not grep global
%t0 = internal global [4 x sbyte] c"foo\00"
%t1 = internal global [4 x sbyte] c"bar\00"
%s1 = internal global [1 x sbyte*] [sbyte* cast ([4 x sbyte]* %t0 to sbyte*)]
%s2 = internal global [1 x sbyte*] [sbyte* getelementptr ([4 x sbyte]* %t1, uint 0, uint 0 )]
%b = internal global int* %a
%a = internal global int 7
@t0 = internal global [4 x i8] c"foo\00" ; <[4 x i8]*> [#uses=1]
@t1 = internal global [4 x i8] c"bar\00" ; <[4 x i8]*> [#uses=1]
@s1 = internal global [1 x i8*] [ i8* getelementptr ([4 x i8]* @t0, i32 0, i32 0) ] ; <[1 x i8*]*> [#uses=0]
@s2 = internal global [1 x i8*] [ i8* getelementptr ([4 x i8]* @t1, i64 0, i64 0) ] ; <[1 x i8*]*> [#uses=0]
@b = internal global i32* @a ; <i32**> [#uses=0]
@a = internal global i32 7 ; <i32*> [#uses=1]

View File

@ -1,13 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -globaldce
; RUN: llvm-as < %s | opt -globaldce
%foo = internal global int 7 ;; Should die when function %foo is killed
;; Should die when function %foo is killed
@foo.upgrd.1 = internal global i32 7 ; <i32*> [#uses=3]
@bar = internal global [2 x { i32*, i32 }] [ { i32*, i32 } { i32* @foo.upgrd.1, i32 7 }, { i32*, i32 } { i32* @foo.upgrd.1, i32 1 } ] ; <[2 x { i32*, i32 }]*> [#uses=0]
%bar = internal global [2x { int *, int }] [ { int *, int } { int* %foo, int 7}, {int*, int} { int* %foo, int 1 }]
implementation
internal int %foo() { ;; dies when %b dies.
%ret = load int* %foo
ret int %ret
define internal i32 @foo() {
%ret = load i32* @foo.upgrd.1 ; <i32> [#uses=1]
ret i32 %ret
}

View File

@ -1,11 +1,11 @@
; distilled from 255.vortex
; RUN: llvm-upgrade < %s | llvm-as | opt -globaldce | llvm-dis | not grep testfunc
; RUN: llvm-as < %s | opt -globaldce | llvm-dis | not grep testfunc
implementation
declare i1 ()* @getfunc()
declare bool()* %getfunc()
internal bool %testfunc() {
%F = call bool()*()* %getfunc()
%c = seteq bool()* %F, %testfunc
ret bool %c
define internal i1 @testfunc() {
%F = call i1 ()* ()* @getfunc( ) ; <i1 ()*> [#uses=1]
%c = icmp eq i1 ()* %F, @testfunc ; <i1> [#uses=1]
ret i1 %c
}

View File

@ -1,6 +1,6 @@
; Weak variables should be preserved by global DCE!
; RUN: llvm-upgrade < %s | llvm-as | opt -globaldce | llvm-dis | grep @A
; RUN: llvm-as < %s | opt -globaldce | llvm-dis | grep @A
%A = weak global int 54
@A = weak global i32 54

View File

@ -1,5 +1,5 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -globaldce | llvm-dis | not grep global
; RUN: llvm-as < %s | opt -globaldce | llvm-dis | not grep global
%X = uninitialized global int
%Y = internal global int 7
@X = external global i32
@Y = internal global i32 7

View File

@ -1,17 +1,17 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt
; RUN: llvm-as < %s | opt -globalopt
%V = global float 12.0
%G = internal global int* null
@V = global float 1.200000e+01 ; <float*> [#uses=1]
@G = internal global i32* null ; <i32**> [#uses=2]
int %user() {
%P = load int** %G
%Q = load int* %P
ret int %Q
define i32 @user() {
%P = load i32** @G ; <i32*> [#uses=1]
%Q = load i32* %P ; <i32> [#uses=1]
ret i32 %Q
}
void %setter() {
%Vi = cast float* %V to int*
store int* %Vi, int** %G
ret void
define void @setter() {
%Vi = bitcast float* @V to i32* ; <i32*> [#uses=1]
store i32* %Vi, i32** @G
ret void
}

View File

@ -1,9 +1,10 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt -disable-output
; RUN: llvm-as < %s | opt -globalopt -disable-output
; PR579
%g_40507551 = internal global short 31038 ; <short*> [#uses=1]
@g_40507551 = internal global i16 31038 ; <i16*> [#uses=1]
void %main() {
%tmp.4.i.1 = load ubyte* getelementptr (ubyte* cast (short* %g_40507551 to ubyte*), int 1)
ret void
define void @main() {
%tmp.4.i.1 = load i8* getelementptr (i8* bitcast (i16* @g_40507551 to i8*), i32 1) ; <i8> [#uses=0]
ret void
}

View File

@ -1,28 +1,27 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt -disable-output
%RPyString = type { int, %arraytype.Char }
%arraytype.Char = type { int, [0 x sbyte] }
%arraytype.Signed = type { int, [0 x int] }
%functiontype.1 = type %RPyString* (int)
%structtype.test = type { int, %arraytype.Signed }
%structinstance.test = internal global { int, { int, [2 x int] } } { int 41, { int, [2 x int] } { int 2, [2 x int] [ int 100, int 101 ] } } ; <{ int, { int, [2 x int] } }*> [#uses=1]
; RUN: llvm-as < %s | opt -globalopt -disable-output
%RPyString = type { i32, %arraytype.Char }
%arraytype.Char = type { i32, [0 x i8] }
%arraytype.Signed = type { i32, [0 x i32] }
%functiontype.1 = type %RPyString* (i32)
%structtype.test = type { i32, %arraytype.Signed }
@structinstance.test = internal global { i32, { i32, [2 x i32] } } { i32 41, { i32, [2 x i32] } { i32 2, [2 x i32] [ i32 100, i32 101 ] } } ; <{ i32, { i32, [2 x i32] } }*> [#uses=1]
implementation ; Functions:
fastcc void %pypy_array_constant() {
define fastcc void @pypy_array_constant() {
block0:
%tmp.9 = getelementptr %structtype.test* cast ({ int, { int, [2 x int] } }* %structinstance.test to %structtype.test*), int 0, uint 0 ; <int*> [#uses=0]
ret void
%tmp.9 = getelementptr %structtype.test* bitcast ({ i32, { i32, [2 x i32] } }* @structinstance.test to %structtype.test*), i32 0, i32 0 ; <i32*> [#uses=0]
ret void
}
fastcc void %new.varsizestruct.rpy_string() {
unreachable
define fastcc void @new.varsizestruct.rpy_string() {
unreachable
}
void %__entrypoint__pypy_array_constant() {
call fastcc void %pypy_array_constant( )
ret void
define void @__entrypoint__pypy_array_constant() {
call fastcc void @pypy_array_constant( )
ret void
}
void %__entrypoint__raised_LLVMException() {
ret void
define void @__entrypoint__raised_LLVMException() {
ret void
}

View File

@ -1,138 +1,135 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt -disable-output
; RUN: llvm-as < %s | opt -globalopt -disable-output
; PR820
target endian = little
target pointersize = 32
target datalayout = "e-p:32:32"
target triple = "i686-pc-linux-gnu"
%struct..0FileDescriptor = type { int }
"struct.FlagDescription<int32>" = type { ubyte*, int*, bool, bool, int, ubyte* }
"struct.FlagRegisterer<bool>" = type { ubyte }
%struct..0FileDescriptor = type { i32 }
%"struct.FlagDescription<int32>" = type { i8*, i32*, i1, i1, i32, i8* }
%"struct.FlagRegisterer<bool>" = type { i8 }
%struct.MutexLock = type { %struct..0FileDescriptor* }
"struct.std::DisabledRangeMap" = type { "struct.std::_Rb_tree<const char*,std::pair<const char* const, FlagDescription<bool> >,std::_Select1st<std::pair<const char* const, FlagDescription<bool> > >,StringCmp,std::allocator<std::pair<const char* const, FlagDescription<bool> > > >" }
"struct.std::_Rb_tree<const char*,std::pair<const char* const, FlagDescription<bool> >,std::_Select1st<std::pair<const char* const, FlagDescription<bool> > >,StringCmp,std::allocator<std::pair<const char* const, FlagDescription<bool> > > >" = type { "struct.std::_Rb_tree<const char*,std::pair<const char* const, FlagDescription<bool> >,std::_Select1st<std::pair<const char* const, FlagDescription<bool> > >,StringCmp,std::allocator<std::pair<const char* const, FlagDescription<bool> > > >::_Rb_tree_impl<StringCmp,false>" }
"struct.std::_Rb_tree<const char*,std::pair<const char* const, FlagDescription<bool> >,std::_Select1st<std::pair<const char* const, FlagDescription<bool> > >,StringCmp,std::allocator<std::pair<const char* const, FlagDescription<bool> > > >::_Rb_tree_impl<StringCmp,false>" = type { "struct.FlagRegisterer<bool>", "struct.std::_Rb_tree_node_base", uint }
"struct.std::_Rb_tree_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >" = type { "struct.std::_Rb_tree_node_base"* }
"struct.std::_Rb_tree_node_base" = type { uint, "struct.std::_Rb_tree_node_base"*, "struct.std::_Rb_tree_node_base"*, "struct.std::_Rb_tree_node_base"* }
"struct.std::_Vector_base<int,std::allocator<int> >" = type { "struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" }
"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" = type { int*, int*, int* }
"struct.std::vector<int,std::allocator<int> >" = type { "struct.std::_Vector_base<int,std::allocator<int> >" }
%registry_lock = external global %struct..0FileDescriptor ; <%struct..0FileDescriptor*> [#uses=0]
%_ZN61FLAG__foo_int32_44FLAGS_E = external global "struct.FlagRegisterer<bool>" ; <"struct.FlagRegisterer<bool>"*> [#uses=0]
%llvm.global_ctors = appending global [20 x { int, void ()* }] [ { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN62FLAG__foo_string_10FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN60FLAG__foo_bool_19FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZNK5Bzh4Enum13is_contiguousEv }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN61FLAG__foo_int32_21FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN7ScannerC2Ev }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__Z11StripStringPSsPKcc }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZNK9__gnu_cxx4hashI11StringPieceEclERKS1_ }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN8Hasher325ResetEj }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__Z25ACLRv }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN61FLAG__foo_int64_25FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN61FLAG__foo_int32_7FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN62FLAG__foo_string_18FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN61FLAG__foo_int32_25FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I_eventbuf }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN61FLAG__foo_int32_26FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN62FLAG__foo_string_16FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN17InitializerC2EPKcS1_PFvvE }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__checker_bcad_variable } ] ; <[20 x { int, void ()* }]*> [#uses=0]
%"struct.std::DisabledRangeMap" = type { %"struct.std::_Rb_tree<const char*,std::pair<const char* const, FlagDescription<bool> >,std::_Select1st<std::pair<const char* const, FlagDescription<bool> > >,StringCmp,std::allocator<std::pair<const char* const, FlagDescription<bool> > > >" }
%"struct.std::_Rb_tree<const char*,std::pair<const char* const, FlagDescription<bool> >,std::_Select1st<std::pair<const char* const, FlagDescription<bool> > >,StringCmp,std::allocator<std::pair<const char* const, FlagDescription<bool> > > >" = type { %"struct.std::_Rb_tree<const char*,std::pair<const char* const, FlagDescription<bool> >,std::_Select1st<std::pair<const char* const, FlagDescription<bool> > >,StringCmp,std::allocator<std::pair<const char* const, FlagDescription<bool> > > >::_Rb_tree_impl<StringCmp,false>" }
%"struct.std::_Rb_tree<const char*,std::pair<const char* const, FlagDescription<bool> >,std::_Select1st<std::pair<const char* const, FlagDescription<bool> > >,StringCmp,std::allocator<std::pair<const char* const, FlagDescription<bool> > > >::_Rb_tree_impl<StringCmp,false>" = type { %"struct.FlagRegisterer<bool>", %"struct.std::_Rb_tree_node_base", i32 }
%"struct.std::_Rb_tree_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >" = type { %"struct.std::_Rb_tree_node_base"* }
%"struct.std::_Rb_tree_node_base" = type { i32, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"* }
%"struct.std::_Vector_base<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" }
%"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" = type { i32*, i32*, i32* }
%"struct.std::vector<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >" }
@registry_lock = external global %struct..0FileDescriptor ; <%struct..0FileDescriptor*> [#uses=0]
@_ZN61FLAG__foo_int32_44FLAGS_E = external global %"struct.FlagRegisterer<bool>" ; <%"struct.FlagRegisterer<bool>"*> [#uses=0]
@llvm.global_ctors = appending global [20 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_10FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN60FLAG__foo_bool_19FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZNK5Bzh4Enum13is_contiguousEv }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_21FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN7ScannerC2Ev }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__Z11StripStringPSsPKcc }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZNK9__gnu_cxx4hashI11StringPieceEclERKS1_ }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN8Hasher325ResetEj }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__Z25ACLRv }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int64_25FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_7FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_18FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_25FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_eventbuf }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_26FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_16FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN17InitializerC2EPKcS1_PFvvE }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__checker_bcad_variable } ] ; <[20 x { i32, void ()* }]*> [#uses=0]
implementation ; Functions:
declare void @_GLOBAL__I__ZN62FLAG__foo_string_10FLAGS_E()
declare void %_GLOBAL__I__ZN62FLAG__foo_string_10FLAGS_E()
declare void @_GLOBAL__I__ZN60FLAG__foo_bool_19FLAGS_E()
declare void %_GLOBAL__I__ZN60FLAG__foo_bool_19FLAGS_E()
declare void @_GLOBAL__I__ZNK5Bzh4Enum13is_contiguousEv()
declare void %_GLOBAL__I__ZNK5Bzh4Enum13is_contiguousEv()
declare void @_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E()
declare void %_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E()
declare void @_GLOBAL__I__ZN61FLAG__foo_int32_21FLAGS_E()
declare void %_GLOBAL__I__ZN61FLAG__foo_int32_21FLAGS_E()
void %_ZN14FlagRegistererIiEC1EPKcRK15FlagDescriptionIiE() {
define void @_ZN14FlagRegistererIiEC1EPKcRK15FlagDescriptionIiE() {
entry:
call void %_Z12RegisterFlagIiEvPKcRK15FlagDescriptionIT_E( )
call void @_Z12RegisterFlagIiEvPKcRK15FlagDescriptionIT_E( )
ret void
}
void %_Z12RegisterFlagIiEvPKcRK15FlagDescriptionIT_E() {
define void @_Z12RegisterFlagIiEvPKcRK15FlagDescriptionIT_E() {
entry:
call void %_ZN9MutexLockC1EP5Mutex( )
call void @_ZN9MutexLockC1EP5Mutex( )
ret void
}
declare void %_GLOBAL__I__ZN7ScannerC2Ev()
declare void @_GLOBAL__I__ZN7ScannerC2Ev()
declare void %_GLOBAL__I__Z11StripStringPSsPKcc()
declare void @_GLOBAL__I__Z11StripStringPSsPKcc()
void %_ZNSt6vectorIiSaIiEEC1ERKS0_() {
define void @_ZNSt6vectorIiSaIiEEC1ERKS0_() {
entry:
unreachable
}
declare void %_GLOBAL__I__ZNK9__gnu_cxx4hashI11StringPieceEclERKS1_()
declare void @_GLOBAL__I__ZNK9__gnu_cxx4hashI11StringPieceEclERKS1_()
declare void %_GLOBAL__I__ZN8Hasher325ResetEj()
declare void @_GLOBAL__I__ZN8Hasher325ResetEj()
declare void %_GLOBAL__I__Z25ACLRv()
declare void @_GLOBAL__I__Z25ACLRv()
void %_ZN9MutexLockC1EP5Mutex() {
define void @_ZN9MutexLockC1EP5Mutex() {
entry:
call void %_ZN5Mutex4LockEv( )
call void @_ZN5Mutex4LockEv( )
ret void
}
void %_ZN5Mutex4LockEv() {
define void @_ZN5Mutex4LockEv() {
entry:
call void %_Z22Acquire_CASPViii( )
call void @_Z22Acquire_CASPViii( )
ret void
}
csretcc void %_ZNSt3mapIPKc15FlagDescriptionIiE9StringCmpSaISt4pairIKS1_S3_EEE3endEv("struct.std::_Rb_tree_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >"* %agg.result) {
define void @_ZNSt3mapIPKc15FlagDescriptionIiE9StringCmpSaISt4pairIKS1_S3_EEE3endEv(%"struct.std::_Rb_tree_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >"* sret %agg.result) {
entry:
unreachable
}
declare void %_GLOBAL__I__ZN61FLAG__foo_int64_25FLAGS_E()
declare void @_GLOBAL__I__ZN61FLAG__foo_int64_25FLAGS_E()
void %_Z14CASPViii() {
define void @_Z14CASPViii() {
entry:
%tmp3 = call int asm sideeffect "lock; cmpxchg $1,$2", "={ax},q,m,0,~{dirflag},~{fpsr},~{flags},~{memory}"( int 0, int* null, int 0 ) ; <int> [#uses=0]
%tmp3 = call i32 asm sideeffect "lock; cmpxchg $1,$2", "={ax},q,m,0,~{dirflag},~{fpsr},~{flags},~{memory}"( i32 0, i32* null, i32 0 ) ; <i32> [#uses=0]
unreachable
}
declare void %_GLOBAL__I__ZN61FLAG__foo_int32_7FLAGS_E()
declare void @_GLOBAL__I__ZN61FLAG__foo_int32_7FLAGS_E()
declare void %_GLOBAL__I__ZN62FLAG__foo_string_18FLAGS_E()
declare void @_GLOBAL__I__ZN62FLAG__foo_string_18FLAGS_E()
void %_Z22Acquire_CASPViii() {
define void @_Z22Acquire_CASPViii() {
entry:
call void %_Z14CASPViii( )
call void @_Z14CASPViii( )
unreachable
}
declare void %_GLOBAL__I__ZN61FLAG__foo_int32_25FLAGS_E()
declare void @_GLOBAL__I__ZN61FLAG__foo_int32_25FLAGS_E()
declare void %_GLOBAL__I_eventbuf()
declare void @_GLOBAL__I_eventbuf()
void %_GLOBAL__I__ZN61FLAG__foo_int32_26FLAGS_E() {
define void @_GLOBAL__I__ZN61FLAG__foo_int32_26FLAGS_E() {
entry:
call void %_Z41__static_initialization_and_destruction_0ii1662( int 1, int 65535 )
call void @_Z41__static_initialization_and_destruction_0ii1662( i32 1, i32 65535 )
ret void
}
void %_Z41__static_initialization_and_destruction_0ii1662(int %__initialize_p, int %__priority) {
define void @_Z41__static_initialization_and_destruction_0ii1662(i32 %__initialize_p, i32 %__priority) {
entry:
%__initialize_p_addr = alloca int ; <int*> [#uses=2]
%__priority_addr = alloca int ; <int*> [#uses=2]
store int %__initialize_p, int* %__initialize_p_addr
store int %__priority, int* %__priority_addr
%tmp = load int* %__priority_addr ; <int> [#uses=1]
%tmp = seteq int %tmp, 65535 ; <bool> [#uses=1]
br bool %tmp, label %cond_true, label %cond_next14
%__initialize_p_addr = alloca i32 ; <i32*> [#uses=2]
%__priority_addr = alloca i32 ; <i32*> [#uses=2]
store i32 %__initialize_p, i32* %__initialize_p_addr
store i32 %__priority, i32* %__priority_addr
%tmp = load i32* %__priority_addr ; <i32> [#uses=1]
%tmp.upgrd.1 = icmp eq i32 %tmp, 65535 ; <i1> [#uses=1]
br i1 %tmp.upgrd.1, label %cond_true, label %cond_next14
cond_true: ; preds = %entry
%tmp8 = load int* %__initialize_p_addr ; <int> [#uses=1]
%tmp9 = seteq int %tmp8, 1 ; <bool> [#uses=1]
br bool %tmp9, label %cond_true10, label %cond_next14
%tmp8 = load i32* %__initialize_p_addr ; <i32> [#uses=1]
%tmp9 = icmp eq i32 %tmp8, 1 ; <i1> [#uses=1]
br i1 %tmp9, label %cond_true10, label %cond_next14
cond_true10: ; preds = %cond_true
call void %_ZN14FlagRegistererIiEC1EPKcRK15FlagDescriptionIiE( )
call void @_ZN14FlagRegistererIiEC1EPKcRK15FlagDescriptionIiE( )
ret void
cond_next14: ; preds = %cond_true, %entry
ret void
}
declare void %_GLOBAL__I__ZN62FLAG__foo_string_16FLAGS_E()
declare void @_GLOBAL__I__ZN62FLAG__foo_string_16FLAGS_E()
void %_ZN9__gnu_cxx13new_allocatorIPNS_15_Hashtable_nodeIjEEEC2Ev() {
define void @_ZN9__gnu_cxx13new_allocatorIPNS_15_Hashtable_nodeIjEEEC2Ev() {
entry:
unreachable
}
declare void %_GLOBAL__I__ZN17InitializerC2EPKcS1_PFvvE()
declare void @_GLOBAL__I__ZN17InitializerC2EPKcS1_PFvvE()
declare void %_GLOBAL__I__checker_bcad_variable()
declare void @_GLOBAL__I__checker_bcad_variable()

View File

@ -1,33 +1,33 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt -disable-output
%struct._list = type { int*, %struct._list* }
%struct._play = type { int, int*, %struct._list*, %struct._play* }
%nrow = internal global int 0 ; <int*> [#uses=2]
; RUN: llvm-as < %s | opt -globalopt -disable-output
implementation ; Functions:
%struct._list = type { i32*, %struct._list* }
%struct._play = type { i32, i32*, %struct._list*, %struct._play* }
@nrow = internal global i32 0 ; <i32*> [#uses=2]
void %make_play() {
define void @make_play() {
entry:
br label %cond_true16.i
br label %cond_true16.i
cond_true16.i: ; preds = %cond_true16.i, %entry
%low.0.in.i.0 = phi int* [ %nrow, %entry ], [ null, %cond_true16.i ] ; <int*> [#uses=1]
%low.0.i = load int* %low.0.in.i.0 ; <int> [#uses=0]
br label %cond_true16.i
cond_true16.i: ; preds = %cond_true16.i, %entry
%low.0.in.i.0 = phi i32* [ @nrow, %entry ], [ null, %cond_true16.i ] ; <i32*> [#uses=1]
%low.0.i = load i32* %low.0.in.i.0 ; <i32> [#uses=0]
br label %cond_true16.i
}
void %make_wanted() {
define void @make_wanted() {
entry:
unreachable
unreachable
}
void %get_good_move() {
define void @get_good_move() {
entry:
ret void
ret void
}
void %main() {
define void @main() {
entry:
store int 8, int* %nrow
tail call void %make_play( )
ret void
store i32 8, i32* @nrow
tail call void @make_play( )
ret void
}

View File

@ -1,9 +1,9 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt | llvm-dis | not grep global
; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
%X = internal global int 4
@X = internal global i32 4 ; <i32*> [#uses=1]
int %foo() {
%V = load int* %X
ret int %V
define i32 @foo() {
%V = load i32* @X ; <i32> [#uses=1]
ret i32 %V
}

View File

@ -1,97 +1,85 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt | llvm-dis | not grep CTOR
; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep CTOR
@llvm.global_ctors = appending global [10 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR2 }, { i32, void ()* } { i32 65535, void ()* @CTOR3 }, { i32, void ()* } { i32 65535, void ()* @CTOR4 }, { i32, void ()* } { i32 65535, void ()* @CTOR5 }, { i32, void ()* } { i32 65535, void ()* @CTOR6 }, { i32, void ()* } { i32 65535, void ()* @CTOR7 }, { i32, void ()* } { i32 65535, void ()* @CTOR8 }, { i32, void ()* } { i32 2147483647, void ()* null } ] ; <[10 x { i32, void ()* }]*> [#uses=0]
@G = global i32 0 ; <i32*> [#uses=1]
@G2 = global i32 0 ; <i32*> [#uses=1]
@G3 = global i32 -123 ; <i32*> [#uses=2]
@X = global { i32, [2 x i32] } { i32 0, [2 x i32] [ i32 17, i32 21 ] } ; <{ i32, [2 x i32] }*> [#uses=2]
@Y = global i32 -1 ; <i32*> [#uses=2]
@Z = global i32 123 ; <i32*> [#uses=1]
@D = global double 0.000000e+00 ; <double*> [#uses=1]
@CTORGV = internal global i1 false ; <i1*> [#uses=2]
%llvm.global_ctors = appending global [10 x { int, void ()* }] [
{ int, void ()* } { int 65535, void ()* %CTOR1 },
{ int, void ()* } { int 65535, void ()* %CTOR1 },
{ int, void ()* } { int 65535, void ()* %CTOR2 },
{ int, void ()* } { int 65535, void ()* %CTOR3 },
{ int, void ()* } { int 65535, void ()* %CTOR4 },
{ int, void ()* } { int 65535, void ()* %CTOR5 },
{ int, void ()* } { int 65535, void ()* %CTOR6 },
{ int, void ()* } { int 65535, void ()* %CTOR7 },
{ int, void ()* } { int 65535, void ()* %CTOR8 },
{ int, void ()* } { int 2147483647, void ()* null }
]
%G = global int 0
%G2 = global int 0
%G3 = global int -123
%X = global {int, [2 x int]} { int 0, [2 x int] [ int 17, int 21] }
%Y = global int -1
%Z = global int 123
%D = global double 0.0
%CTORGV = internal global bool false ;; Should become constant after eval
implementation
internal void %CTOR1() { ;; noop ctor, remove.
ret void
define internal void @CTOR1() {
ret void
}
internal void %CTOR2() { ;; evaluate the store
%A = add int 1, 23
store int %A, int* %G
store bool true, bool* %CTORGV
ret void
define internal void @CTOR2() {
%A = add i32 1, 23 ; <i32> [#uses=1]
store i32 %A, i32* @G
store i1 true, i1* @CTORGV
ret void
}
internal void %CTOR3() {
%X = or bool true, false
define internal void @CTOR3() {
%X = or i1 true, false ; <i1> [#uses=1]
br label %Cont
Cont:
br bool %X, label %S, label %T
S:
store int 24, int* %G2
Cont: ; preds = %0
br i1 %X, label %S, label %T
S: ; preds = %Cont
store i32 24, i32* @G2
ret void
T:
T: ; preds = %Cont
ret void
}
internal void %CTOR4() {
%X = load int* %G3
%Y = add int %X, 123
store int %Y, int* %G3
define internal void @CTOR4() {
%X = load i32* @G3 ; <i32> [#uses=1]
%Y = add i32 %X, 123 ; <i32> [#uses=1]
store i32 %Y, i32* @G3
ret void
}
internal void %CTOR5() {
%X.2p = getelementptr {int,[2 x int]}* %X, int 0, uint 1, int 0
%X.2 = load int* %X.2p
%X.1p = getelementptr {int,[2 x int]}* %X, int 0, uint 0
store int %X.2, int* %X.1p
store int 42, int* %X.2p
define internal void @CTOR5() {
%X.2p = getelementptr { i32, [2 x i32] }* @X, i32 0, i32 1, i32 0 ; <i32*> [#uses=2]
%X.2 = load i32* %X.2p ; <i32> [#uses=1]
%X.1p = getelementptr { i32, [2 x i32] }* @X, i32 0, i32 0 ; <i32*> [#uses=1]
store i32 %X.2, i32* %X.1p
store i32 42, i32* %X.2p
ret void
}
internal void %CTOR6() {
%A = alloca int
%y = load int* %Y
store int %y, int* %A
%Av = load int* %A
%Av1 = add int %Av, 1
store int %Av1, int* %Y
define internal void @CTOR6() {
%A = alloca i32 ; <i32*> [#uses=2]
%y = load i32* @Y ; <i32> [#uses=1]
store i32 %y, i32* %A
%Av = load i32* %A ; <i32> [#uses=1]
%Av1 = add i32 %Av, 1 ; <i32> [#uses=1]
store i32 %Av1, i32* @Y
ret void
}
internal void %CTOR7() {
call void %setto(int* %Z, int 0)
define internal void @CTOR7() {
call void @setto( i32* @Z, i32 0 )
ret void
}
void %setto(int* %P, int %V) {
store int %V, int* %P
define void @setto(i32* %P, i32 %V) {
store i32 %V, i32* %P
ret void
}
declare double %cos(double)
declare double @cos(double)
internal void %CTOR8() {
%X = call double %cos(double 1.0)
store double %X, double* %D
define internal void @CTOR8() {
%X = call double @cos( double 1.000000e+00 ) ; <double> [#uses=1]
store double %X, double* @D
ret void
}
bool %accessor() {
%V = load bool* %CTORGV ;; constant true
ret bool %V
define i1 @accessor() {
%V = load i1* @CTORGV ; <i1> [#uses=1]
ret i1 %V
}

View File

@ -1,8 +1,9 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt | llvm-dis | not grep internal
; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep internal
%G = internal global int 123
@G = internal global i32 123 ; <i32*> [#uses=1]
void %foo() {
store int 1, int* %G
ret void
define void @foo() {
store i32 1, i32* @G
ret void
}

View File

@ -1,23 +1,23 @@
; In this case, the global can only be broken up by one level.
; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt | llvm-dis | not grep 12345
; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep 12345
%G = internal global { int, [4 x float] } zeroinitializer
@G = internal global { i32, [4 x float] } zeroinitializer ; <{ i32, [4 x float] }*> [#uses=3]
void %onlystore() {
store int 12345, int* getelementptr ({ int, [4 x float] }* %G, int 0, uint 0)
ret void
define void @onlystore() {
store i32 12345, i32* getelementptr ({ i32, [4 x float] }* @G, i32 0, i32 0)
ret void
}
void %storeinit(int %i) {
%Ptr = getelementptr { int, [4 x float] }* %G, int 0, uint 1, int %i
store float 1.0, float* %Ptr
ret void
define void @storeinit(i32 %i) {
%Ptr = getelementptr { i32, [4 x float] }* @G, i32 0, i32 1, i32 %i ; <float*> [#uses=1]
store float 1.000000e+00, float* %Ptr
ret void
}
float %readval(int %i) {
%Ptr = getelementptr { int, [4 x float] }* %G, int 0, uint 1, int %i
%V = load float* %Ptr
ret float %V
define float @readval(i32 %i) {
%Ptr = getelementptr { i32, [4 x float] }* @G, i32 0, i32 1, i32 %i ; <float*> [#uses=1]
%V = load float* %Ptr ; <float> [#uses=1]
ret float %V
}

Some files were not shown because too many files have changed in this diff Show More