[ADCE] Update tests to use opaque pointers (NFC)

Update performed using:
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34

This time without any manual fixup.
This commit is contained in:
Nikita Popov 2022-06-22 12:24:43 +02:00
parent d29e986ed5
commit 563cf93776
18 changed files with 148 additions and 152 deletions

View File

@ -7,25 +7,25 @@
; RUN: opt < %s -S -passes=adce | grep bb1
; RUN: opt < %s -S -passes=adce -adce-remove-loops | FileCheck %s
%node_t = type { double*, %node_t*, %node_t**, double**, double*, i32, i32 }
%node_t = type { ptr, ptr, ptr, ptr, ptr, i32, i32 }
define void @localize_local(%node_t* %nodelist) {
define void @localize_local(ptr %nodelist) {
bb0:
%nodelist.upgrd.1 = alloca %node_t* ; <%node_t**> [#uses=2]
store %node_t* %nodelist, %node_t** %nodelist.upgrd.1
%nodelist.upgrd.1 = alloca ptr ; <ptr> [#uses=2]
store ptr %nodelist, ptr %nodelist.upgrd.1
br label %bb1
bb1: ; preds = %bb0
%reg107 = load %node_t*, %node_t** %nodelist.upgrd.1 ; <%node_t*> [#uses=2]
%cond211 = icmp eq %node_t* %reg107, null ; <i1> [#uses=1]
%reg107 = load ptr, ptr %nodelist.upgrd.1 ; <ptr> [#uses=2]
%cond211 = icmp eq ptr %reg107, null ; <i1> [#uses=1]
; CHECK: br label %bb3
br i1 %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, %node_t* %reg109, i64 0, i32 1 ; <%node_t**> [#uses=1]
%reg110 = load %node_t*, %node_t** %reg212 ; <%node_t*> [#uses=2]
%cond213 = icmp ne %node_t* %reg110, null ; <i1> [#uses=1]
%reg109 = phi ptr [ %reg110, %bb2 ], [ %reg107, %bb1 ] ; <ptr> [#uses=1]
%reg212 = getelementptr %node_t, ptr %reg109, i64 0, i32 1 ; <ptr> [#uses=1]
%reg110 = load ptr, ptr %reg212 ; <ptr> [#uses=2]
%cond213 = icmp ne ptr %reg110, null ; <i1> [#uses=1]
; CHECK: br label %bb3
br i1 %cond213, label %bb2, label %bb3

View File

@ -14,10 +14,10 @@
; RUN: opt < %s -passes=adce
; RUN: opt < %s -passes=adce -adce-remove-loops -S | FileCheck %s
define i32 @rx_bitset_empty(i32 %size, i32* %set) {
define i32 @rx_bitset_empty(i32 %size, ptr %set) {
bb1:
%reg110 = load i32, i32* %set ; <i32> [#uses=2]
store i32 1, i32* %set
%reg110 = load i32, ptr %set ; <i32> [#uses=2]
store i32 1, ptr %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]
@ -26,8 +26,8 @@ bb1:
%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, i32* %set, i64 %reg114-idxcast-offset.upgrd.1 ; <i32*> [#uses=1]
%reg125 = load i32, i32* %reg124 ; <i32> [#uses=1]
%reg124 = getelementptr i32, ptr %set, i64 %reg114-idxcast-offset.upgrd.1 ; <ptr> [#uses=1]
%reg125 = load i32, ptr %reg124 ; <i32> [#uses=1]
%cond232 = icmp ne i32 %reg125, 0 ; <i1> [#uses=1]
; CHECK: br label %bb3
br i1 %cond232, label %bb3, label %bb2
@ -40,13 +40,13 @@ bb2: ; preds = %bb2, %bb1
%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, i32* %set, i64 %reg130-idxcast-offset.upgrd.2 ; <i32*> [#uses=1]
%reg119 = load i32, i32* %reg118 ; <i32> [#uses=1]
%reg118 = getelementptr i32, ptr %set, i64 %reg130-idxcast-offset.upgrd.2 ; <ptr> [#uses=1]
%reg119 = load i32, ptr %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
store i32 %reg110, ptr %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]

View File

@ -5,10 +5,9 @@
;
; RUN: opt < %s -passes=adce -S | FileCheck %s
define void @foo(i8* %reg5481) {
%cast611 = bitcast i8* %reg5481 to i8** ; <i8**> [#uses=1]
%reg162 = load i8*, i8** %cast611 ; <i8*> [#uses=1]
define void @foo(ptr %reg5481) {
%reg162 = load ptr, ptr %reg5481 ; <ptr> [#uses=1]
; CHECK-NOT: ptrtoint
ptrtoint i8* %reg162 to i32 ; <i32>:1 [#uses=0]
ptrtoint ptr %reg162 to i32 ; <i32>:1 [#uses=0]
ret void
}

View File

@ -2,8 +2,8 @@
;
; RUN: opt < %s -passes=adce | FileCheck %s
@bk = external global i32 ; <i32*> [#uses=2]
@hufts = external global i32 ; <i32*> [#uses=1]
@bk = external global i32 ; <ptr> [#uses=2]
@hufts = external global i32 ; <ptr> [#uses=1]
define i32 @inflate() {
bb0:
@ -19,7 +19,7 @@ bb3: ; preds = %bb2
; CHECK-NOT: bb4:
; CHECK-NOT: bb5:
bb4: ; preds = %bb2
%reg117 = load i32, i32* @hufts ; <i32> [#uses=2]
%reg117 = load i32, ptr @hufts ; <i32> [#uses=2]
%cond241 = icmp ule i32 %reg117, %reg128 ; <i1> [#uses=1]
br i1 %cond241, label %bb6, label %bb5
@ -31,12 +31,12 @@ bb6: ; preds = %bb5, %bb4
br i1 false, label %bb2, label %bb7
bb7: ; preds = %bb6
%reg126 = load i32, i32* @bk ; <i32> [#uses=1]
%reg126 = load i32, ptr @bk ; <i32> [#uses=1]
%cond247 = icmp ule i32 %reg126, 7 ; <i1> [#uses=1]
br i1 %cond247, label %bb9, label %bb8
bb8: ; preds = %bb8, %bb7
%reg119 = load i32, i32* @bk ; <i32> [#uses=1]
%reg119 = load i32, ptr @bk ; <i32> [#uses=1]
%cond256 = icmp ugt i32 %reg119, 7 ; <i1> [#uses=1]
br i1 %cond256, label %bb8, label %bb9

View File

@ -7,12 +7,11 @@ define void @conjunction_prune() {
br label %bb19
bb19: ; preds = %bb23, %bb22, %0
%reg205 = phi i8* [ null, %bb22 ], [ null, %bb23 ], [ null, %0 ] ; <i8*> [#uses=1]
%reg205 = phi ptr [ null, %bb22 ], [ null, %bb23 ], [ null, %0 ] ; <ptr> [#uses=1]
; CHECK: br label %bb22
br i1 false, label %bb21, label %bb22
bb21: ; preds = %bb19
%cast455 = bitcast i8* %reg205 to i8** ; <i8**> [#uses=0]
; CHECK: br label %bb22
br label %bb22

View File

@ -28,7 +28,7 @@ else: ; preds = %no_exit
endif: ; preds = %else, %then
%k.0 = phi i32 [ %dec, %else ], [ 0, %then ] ; <i32> [#uses=1]
store i32 2, i32* null
store i32 2, ptr null
br label %loopentry
return: ; preds = %loopentry

View File

@ -1,11 +1,11 @@
; RUN: opt < %s -passes=adce -disable-output
; RUN: opt < %s -passes=adce -adce-remove-loops -disable-output
@G = external global i32* ; <i32**> [#uses=1]
@G = external global ptr ; <ptr> [#uses=1]
declare void @Fn(i32*)
declare void @Fn(ptr)
define i32 @main(i32 %argc.1, i8** %argv.1) {
define i32 @main(i32 %argc.1, ptr %argv.1) {
entry:
br label %endif.42
@ -13,11 +13,11 @@ endif.42: ; preds = %shortcirc_done.12, %then.66, %endif.42, %entr
br i1 false, label %endif.65, label %endif.42
then.66: ; preds = %shortcirc_done.12
call void @Fn( i32* %tmp.2846 )
call void @Fn( ptr %tmp.2846 )
br label %endif.42
endif.65: ; preds = %endif.42
%tmp.2846 = load i32*, i32** @G ; <i32*> [#uses=1]
%tmp.2846 = load ptr, ptr @G ; <ptr> [#uses=1]
br i1 false, label %shortcirc_next.12, label %shortcirc_done.12
shortcirc_next.12: ; preds = %endif.65

View File

@ -28,7 +28,7 @@ endif.14: ; preds = %loopentry.0
br i1 false, label %loopentry.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]
%SubArrays.10 = phi ptr [ %SubArrays.8, %then.53 ], [ null, %endif.14 ] ; <ptr> [#uses=3]
br i1 false, label %no_exit.1, label %loopentry.0
no_exit.1: ; preds = %loopentry.1
@ -51,9 +51,9 @@ shortcirc_next.4: ; preds = %then.44
br i1 false, label %no_exit.2, label %loopexit.2
no_exit.2: ; preds = %shortcirc_next.4
%tmp.897 = getelementptr i32, i32* %SubArrays.10, i64 0 ; <i32*> [#uses=1]
%tmp.899 = load i32, i32* %tmp.897 ; <i32> [#uses=1]
store i32 %tmp.899, i32* null
%tmp.897 = getelementptr i32, ptr %SubArrays.10, i64 0 ; <ptr> [#uses=1]
%tmp.899 = load i32, ptr %tmp.897 ; <i32> [#uses=1]
store i32 %tmp.899, ptr null
ret i32 0
loopexit.2: ; preds = %shortcirc_next.4
@ -81,8 +81,8 @@ shortcirc_next.8: ; preds = %shortcirc_next.7
ret i32 0
then.53: ; preds = %shortcirc_next.7, %label.17
%SubArrays.8 = phi i32* [ %SubArrays.10, %shortcirc_next.7 ], [ %SubArrays.10, %label.17 ] ; <i32*> [#uses=1]
%tmp.1023 = load i32, i32* null ; <i32> [#uses=1]
%SubArrays.8 = phi ptr [ %SubArrays.10, %shortcirc_next.7 ], [ %SubArrays.10, %label.17 ] ; <ptr> [#uses=1]
%tmp.1023 = load i32, ptr null ; <i32> [#uses=1]
switch i32 %tmp.1023, label %loopentry.1 [
]

View File

@ -1,22 +1,22 @@
; RUN: opt < %s -passes=adce -S | FileCheck %s
; RUN: opt < %s -passes=adce -adce-remove-loops -S | FileCheck %s
define void @dead_test8(i32* %data.1, i32 %idx.1) {
define void @dead_test8(ptr %data.1, i32 %idx.1) {
entry:
%tmp.1 = load i32, i32* %data.1 ; <i32> [#uses=2]
%tmp.1 = load i32, ptr %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 i32, i32* %data.1, i64 1 ; <i32*> [#uses=1]
%tmp.11 = getelementptr i32, ptr %data.1, i64 1 ; <ptr> [#uses=1]
%tmp.22-idxcast = sext i32 %idx.1 to i64 ; <i64> [#uses=1]
%tmp.28 = getelementptr i32, i32* %data.1, i64 %tmp.22-idxcast ; <i32*> [#uses=1]
%tmp.28 = getelementptr i32, ptr %data.1, i64 %tmp.22-idxcast ; <ptr> [#uses=1]
br label %no_exit
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, i32* %tmp.11 ; <i32> [#uses=1]
%tmp.12 = load i32, ptr %tmp.11 ; <i32> [#uses=1]
%tmp.14 = sub i32 0, %tmp.12 ; <i32> [#uses=1]
; CHECK-NOT: %tmp.161
%tmp.161 = icmp ne i32 %k.1, %tmp.14 ; <i1> [#uses=1]
@ -33,7 +33,7 @@ else: ; preds = %no_exit
endif: ; preds = %else, %then
%k.0 = phi i32 [ %dec, %else ], [ %inc.0, %then ] ; <i32> [#uses=1]
store i32 2, i32* %tmp.28
store i32 2, ptr %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

View File

@ -1,16 +1,16 @@
; RUN: opt < %s -passes=adce -disable-output
define void @test() personality i32 (...)* @__gxx_personality_v0 {
define void @test() personality ptr @__gxx_personality_v0 {
br i1 false, label %then, label %endif
then: ; preds = %0
invoke void null( i8* null )
invoke void null( ptr null )
to label %invoke_cont unwind label %invoke_catch
invoke_catch: ; preds = %then
%exn = landingpad {i8*, i32}
%exn = landingpad {ptr, i32}
cleanup
resume { i8*, i32 } %exn
resume { ptr, i32 } %exn
invoke_cont: ; preds = %then
ret void

View File

@ -6,7 +6,7 @@ declare void @_ZN10QByteArray6resizeEi()
declare void @q_atomic_decrement()
define void @_ZNK10QByteArray13leftJustifiedEicb() personality i32 (...)* @__gxx_personality_v0 {
define void @_ZNK10QByteArray13leftJustifiedEicb() personality ptr @__gxx_personality_v0 {
entry:
invoke void @strlen( )
to label %tmp.3.i.noexc unwind label %invoke_catch.0
@ -15,7 +15,7 @@ tmp.3.i.noexc: ; preds = %entry
br i1 false, label %then.0, label %else.0
invoke_catch.0: ; preds = %entry
%exn.0 = landingpad {i8*, i32}
%exn.0 = landingpad {ptr, i32}
cleanup
invoke void @q_atomic_decrement( )
to label %tmp.1.i.i183.noexc unwind label %terminate
@ -28,7 +28,7 @@ then.0: ; preds = %tmp.3.i.noexc
to label %invoke_cont.1 unwind label %invoke_catch.1
invoke_catch.1: ; preds = %then.0
%exn.1 = landingpad {i8*, i32}
%exn.1 = landingpad {ptr, i32}
cleanup
invoke void @q_atomic_decrement( )
to label %tmp.1.i.i162.noexc unwind label %terminate
@ -43,8 +43,8 @@ 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=0]
%exn = landingpad {i8*, i32}
%dbg.0.1 = phi ptr [ null, %invoke_catch.1 ], [ null, %invoke_catch.0 ] ; <ptr> [#uses=0]
%exn = landingpad {ptr, i32}
cleanup
unreachable
}

View File

@ -11,21 +11,21 @@ define i32 @foo(i32, i32, i32) #0 {
%6 = alloca i32, align 4
%7 = alloca i32, align 4
%8 = alloca i32, align 4
store i32 %0, i32* %4, align 4
store i32 %1, i32* %5, align 4
store i32 %2, i32* %6, align 4
store i32 0, i32* %7, align 4
%9 = load i32, i32* %5, align 4
store i32 %0, ptr %4, align 4
store i32 %1, ptr %5, align 4
store i32 %2, ptr %6, align 4
store i32 0, ptr %7, align 4
%9 = load i32, ptr %5, align 4
%I10 = icmp ne i32 %9, 0
br i1 %I10, label %B11, label %B21
B11:
store i32 0, i32* %8, align 4
store i32 0, ptr %8, align 4
br label %B12
B12:
%I13 = load i32, i32* %8, align 4
%I14 = load i32, i32* %6, align 4
%I13 = load i32, ptr %8, align 4
%I14 = load i32, ptr %6, align 4
%I15 = icmp slt i32 %I13, %I14
; CHECK: br label %B20
br i1 %I15, label %B16, label %B20
@ -34,17 +34,17 @@ B16:
br label %B17
B17:
%I18 = load i32, i32* %8, align 4
%I18 = load i32, ptr %8, align 4
%I19 = add nsw i32 %I18, 1
store i32 %I19, i32* %8, align 4
store i32 %I19, ptr %8, align 4
br label %B12
B20:
store i32 1, i32* %7, align 4
store i32 1, ptr %7, align 4
br label %B21
B21:
%I22 = load i32, i32* %7, align 4
%I22 = load i32, ptr %7, align 4
ret i32 %I22
}

View File

@ -1,36 +1,36 @@
; RUN: opt < %s -passes=adce -S | FileCheck %s
; RUN: opt < %s -passes=adce -adce-remove-loops -S | FileCheck %s
%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 { i32, ptr, ptr, i8, i8, i32, i32, i32 }
%spec_fd_t = type { i32, i32, i32, ptr }
@__iob = external global [20 x %FILE] ; <ptr> [#uses=1]
@dbglvl = global i32 4 ; <ptr> [#uses=3]
@spec_fd = external global [3 x %spec_fd_t] ; <ptr> [#uses=4]
@.LC9 = internal global [34 x i8] c"spec_read: fd=%d, > MAX_SPEC_FD!\0A\00" ; <ptr> [#uses=1]
@.LC10 = internal global [4 x i8] c"EOF\00" ; <ptr> [#uses=1]
@.LC11 = internal global [4 x i8] c"%d\0A\00" ; <ptr> [#uses=1]
@.LC12 = internal global [17 x i8] c"spec_getc: %d = \00" ; <ptr> [#uses=1]
declare i32 @fprintf(%FILE*, i8*, ...)
declare i32 @fprintf(ptr, ptr, ...)
declare void @exit(i32)
declare i32 @remove(i8*)
declare i32 @remove(ptr)
declare i32 @fputc(i32, %FILE*)
declare i32 @fputc(i32, ptr)
declare i32 @fwrite(i8*, i32, i32, %FILE*)
declare i32 @fwrite(ptr, i32, i32, ptr)
declare void @perror(i8*)
declare void @perror(ptr)
define i32 @spec_getc(i32 %fd) {
%reg109 = load i32, i32* @dbglvl ; <i32> [#uses=1]
%reg109 = load i32, ptr @dbglvl ; <i32> [#uses=1]
%cond266 = icmp sle i32 %reg109, 4 ; <i1> [#uses=1]
; CHECKL br label %bb3
br i1 %cond266, label %bb3, label %bb2
bb2: ; preds = %0
%cast273 = getelementptr [17 x i8], [17 x i8]* @.LC12, i64 0, i64 0 ; <i8*> [#uses=0]
%cast273 = getelementptr [17 x i8], ptr @.LC12, i64 0, i64 0 ; <ptr> [#uses=0]
br label %bb3
bb3: ; preds = %bb2, %0
@ -38,31 +38,30 @@ bb3: ; preds = %bb2, %0
br i1 %cond267, label %bb5, label %bb4
bb4: ; preds = %bb3
%reg111 = getelementptr [20 x %FILE], [20 x %FILE]* @__iob, i64 0, i64 1, i32 3 ; <i8*> [#uses=1]
%cast274 = getelementptr [34 x i8], [34 x i8]* @.LC9, i64 0, i64 0 ; <i8*> [#uses=0]
%cast282 = bitcast i8* %reg111 to %FILE* ; <%FILE*> [#uses=0]
%reg111 = getelementptr [20 x %FILE], ptr @__iob, i64 0, i64 1, i32 3 ; <ptr> [#uses=1]
%cast274 = getelementptr [34 x i8], ptr @.LC9, i64 0, i64 0 ; <ptr> [#uses=0]
call void @exit( i32 1 )
br label %UnifiedExitNode
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], [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast2 ; <%spec_fd_t*> [#uses=1]
%idx1 = getelementptr [3 x %spec_fd_t], [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <i32*> [#uses=1]
%reg1321 = load i32, i32* %idx1 ; <i32> [#uses=3]
%idx2 = getelementptr %spec_fd_t, %spec_fd_t* %reg1311, i64 0, i32 1 ; <i32*> [#uses=1]
%reg1331 = load i32, i32* %idx2 ; <i32> [#uses=1]
%reg1311 = getelementptr [3 x %spec_fd_t], ptr @spec_fd, i64 0, i64 %reg107-idxcast2 ; <ptr> [#uses=1]
%idx1 = getelementptr [3 x %spec_fd_t], ptr @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <ptr> [#uses=1]
%reg1321 = load i32, ptr %idx1 ; <i32> [#uses=3]
%idx2 = getelementptr %spec_fd_t, ptr %reg1311, i64 0, i32 1 ; <ptr> [#uses=1]
%reg1331 = load i32, ptr %idx2 ; <i32> [#uses=1]
%cond270 = icmp slt i32 %reg1321, %reg1331 ; <i1> [#uses=1]
br i1 %cond270, label %bb9, label %bb6
bb6: ; preds = %bb5
%reg134 = load i32, i32* @dbglvl ; <i32> [#uses=1]
%reg134 = load i32, ptr @dbglvl ; <i32> [#uses=1]
%cond271 = icmp sle i32 %reg134, 4 ; <i1> [#uses=1]
; CHECK: br label %bb8
br i1 %cond271, label %bb8, label %bb7
bb7: ; preds = %bb6
%cast277 = getelementptr [4 x i8], [4 x i8]* @.LC10, i64 0, i64 0 ; <i8*> [#uses=0]
%cast277 = getelementptr [4 x i8], ptr @.LC10, i64 0, i64 0 ; <ptr> [#uses=0]
br label %bb8
bb8: ; preds = %bb7, %bb6
@ -70,22 +69,22 @@ bb8: ; preds = %bb7, %bb6
bb9: ; preds = %bb5
%reg107-idxcast3 = sext i32 %fd to i64 ; <i64> [#uses=1]
%idx3 = getelementptr [3 x %spec_fd_t], [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast3, i32 3 ; <i8**> [#uses=1]
%reg1601 = load i8*, i8** %idx3 ; <i8*> [#uses=1]
%idx3 = getelementptr [3 x %spec_fd_t], ptr @spec_fd, i64 0, i64 %reg107-idxcast3, i32 3 ; <ptr> [#uses=1]
%reg1601 = load ptr, ptr %idx3 ; <ptr> [#uses=1]
%reg132-idxcast1 = sext i32 %reg1321 to i64 ; <i64> [#uses=1]
%idx4 = getelementptr i8, i8* %reg1601, i64 %reg132-idxcast1 ; <i8*> [#uses=1]
%reg1621 = load i8, i8* %idx4 ; <i8> [#uses=2]
%idx4 = getelementptr i8, ptr %reg1601, i64 %reg132-idxcast1 ; <ptr> [#uses=1]
%reg1621 = load i8, ptr %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], [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, i32* @dbglvl ; <i32> [#uses=1]
%idx5 = getelementptr [3 x %spec_fd_t], ptr @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <ptr> [#uses=1]
store i32 %reg157, ptr %idx5
%reg163 = load i32, ptr @dbglvl ; <i32> [#uses=1]
%cond272 = icmp sle i32 %reg163, 4 ; <i1> [#uses=1]
; CHECK: br label %bb11
br i1 %cond272, label %bb11, label %bb10
bb10: ; preds = %bb9
%cast279 = getelementptr [4 x i8], [4 x i8]* @.LC11, i64 0, i64 0 ; <i8*> [#uses=0]
%cast279 = getelementptr [4 x i8], ptr @.LC11, i64 0, i64 0 ; <ptr> [#uses=0]
br label %bb11
bb11: ; preds = %bb10, %bb9
@ -97,6 +96,6 @@ UnifiedExitNode: ; preds = %bb11, %bb8, %bb4
ret i32 %UnifiedRetVal
}
declare i32 @puts(i8*)
declare i32 @puts(ptr)
declare i32 @printf(i8*, ...)
declare i32 @printf(ptr, ...)

View File

@ -1,36 +1,36 @@
; RUN: opt < %s -passes=adce -disable-output
; RUN: opt < %s -passes=adce -adce-remove-loops -S | FileCheck %s
%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 { i32, ptr, ptr, i8, i8, i32, i32, i32 }
%spec_fd_t = type { i32, i32, i32, ptr }
@__iob = external global [20 x %FILE] ; <ptr> [#uses=1]
@dbglvl = global i32 4 ; <ptr> [#uses=3]
@spec_fd = external global [3 x %spec_fd_t] ; <ptr> [#uses=4]
@.LC9 = internal global [34 x i8] c"spec_read: fd=%d, > MAX_SPEC_FD!\0A\00" ; <ptr> [#uses=1]
@.LC10 = internal global [4 x i8] c"EOF\00" ; <ptr> [#uses=1]
@.LC11 = internal global [4 x i8] c"%d\0A\00" ; <ptr> [#uses=1]
@.LC12 = internal global [17 x i8] c"spec_getc: %d = \00" ; <ptr> [#uses=1]
declare i32 @fprintf(%FILE*, i8*, ...)
declare i32 @fprintf(ptr, ptr, ...)
declare void @exit(i32)
declare i32 @remove(i8*)
declare i32 @remove(ptr)
declare i32 @fputc(i32, %FILE*)
declare i32 @fputc(i32, ptr)
declare i32 @fwrite(i8*, i32, i32, %FILE*)
declare i32 @fwrite(ptr, i32, i32, ptr)
declare void @perror(i8*)
declare void @perror(ptr)
define i32 @spec_getc(i32 %fd) {
%reg109 = load i32, i32* @dbglvl ; <i32> [#uses=1]
%reg109 = load i32, ptr @dbglvl ; <i32> [#uses=1]
%cond266 = icmp sle i32 %reg109, 4 ; <i1> [#uses=1]
; CHECK: br label %bb3
br i1 %cond266, label %bb3, label %bb2
bb2: ; preds = %0
%cast273 = getelementptr [17 x i8], [17 x i8]* @.LC12, i64 0, i64 0 ; <i8*> [#uses=0]
%cast273 = getelementptr [17 x i8], ptr @.LC12, i64 0, i64 0 ; <ptr> [#uses=0]
br label %bb3
bb3: ; preds = %bb2, %0
@ -38,31 +38,30 @@ bb3: ; preds = %bb2, %0
br label %bb5
bb4: ; No predecessors!
%reg111 = getelementptr [20 x %FILE], [20 x %FILE]* @__iob, i64 0, i64 1, i32 3 ; <i8*> [#uses=1]
%cast274 = getelementptr [34 x i8], [34 x i8]* @.LC9, i64 0, i64 0 ; <i8*> [#uses=0]
%cast282 = bitcast i8* %reg111 to %FILE* ; <%FILE*> [#uses=0]
%reg111 = getelementptr [20 x %FILE], ptr @__iob, i64 0, i64 1, i32 3 ; <ptr> [#uses=1]
%cast274 = getelementptr [34 x i8], ptr @.LC9, i64 0, i64 0 ; <ptr> [#uses=0]
call void @exit( i32 1 )
br label %UnifiedExitNode
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], [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast2 ; <%spec_fd_t*> [#uses=1]
%idx1 = getelementptr [3 x %spec_fd_t], [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <i32*> [#uses=1]
%reg1321 = load i32, i32* %idx1 ; <i32> [#uses=3]
%idx2 = getelementptr %spec_fd_t, %spec_fd_t* %reg1311, i64 0, i32 1 ; <i32*> [#uses=1]
%reg1331 = load i32, i32* %idx2 ; <i32> [#uses=1]
%reg1311 = getelementptr [3 x %spec_fd_t], ptr @spec_fd, i64 0, i64 %reg107-idxcast2 ; <ptr> [#uses=1]
%idx1 = getelementptr [3 x %spec_fd_t], ptr @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <ptr> [#uses=1]
%reg1321 = load i32, ptr %idx1 ; <i32> [#uses=3]
%idx2 = getelementptr %spec_fd_t, ptr %reg1311, i64 0, i32 1 ; <ptr> [#uses=1]
%reg1331 = load i32, ptr %idx2 ; <i32> [#uses=1]
%cond270 = icmp slt i32 %reg1321, %reg1331 ; <i1> [#uses=1]
br i1 %cond270, label %bb9, label %bb6
bb6: ; preds = %bb5
%reg134 = load i32, i32* @dbglvl ; <i32> [#uses=1]
%reg134 = load i32, ptr @dbglvl ; <i32> [#uses=1]
%cond271 = icmp sle i32 %reg134, 4 ; <i1> [#uses=1]
; CHECK: br label %bb8
br i1 %cond271, label %bb8, label %bb7
bb7: ; preds = %bb6
%cast277 = getelementptr [4 x i8], [4 x i8]* @.LC10, i64 0, i64 0 ; <i8*> [#uses=0]
%cast277 = getelementptr [4 x i8], ptr @.LC10, i64 0, i64 0 ; <ptr> [#uses=0]
br label %bb8
bb8: ; preds = %bb7, %bb6
@ -70,22 +69,22 @@ bb8: ; preds = %bb7, %bb6
bb9: ; preds = %bb5
%reg107-idxcast3 = sext i32 %fd to i64 ; <i64> [#uses=1]
%idx3 = getelementptr [3 x %spec_fd_t], [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast3, i32 3 ; <i8**> [#uses=1]
%reg1601 = load i8*, i8** %idx3 ; <i8*> [#uses=1]
%idx3 = getelementptr [3 x %spec_fd_t], ptr @spec_fd, i64 0, i64 %reg107-idxcast3, i32 3 ; <ptr> [#uses=1]
%reg1601 = load ptr, ptr %idx3 ; <ptr> [#uses=1]
%reg132-idxcast1 = sext i32 %reg1321 to i64 ; <i64> [#uses=1]
%idx4 = getelementptr i8, i8* %reg1601, i64 %reg132-idxcast1 ; <i8*> [#uses=1]
%reg1621 = load i8, i8* %idx4 ; <i8> [#uses=2]
%idx4 = getelementptr i8, ptr %reg1601, i64 %reg132-idxcast1 ; <ptr> [#uses=1]
%reg1621 = load i8, ptr %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], [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, i32* @dbglvl ; <i32> [#uses=1]
%idx5 = getelementptr [3 x %spec_fd_t], ptr @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <ptr> [#uses=1]
store i32 %reg157, ptr %idx5
%reg163 = load i32, ptr @dbglvl ; <i32> [#uses=1]
%cond272 = icmp sle i32 %reg163, 4 ; <i1> [#uses=1]
; CHECK: br label %bb11
br i1 %cond272, label %bb11, label %bb10
bb10: ; preds = %bb9
%cast279 = getelementptr [4 x i8], [4 x i8]* @.LC11, i64 0, i64 0 ; <i8*> [#uses=0]
%cast279 = getelementptr [4 x i8], ptr @.LC11, i64 0, i64 0 ; <ptr> [#uses=0]
br label %bb11
bb11: ; preds = %bb10, %bb9
@ -97,6 +96,6 @@ UnifiedExitNode: ; preds = %bb11, %bb8, %bb4
ret i32 %UnifiedRetVal
}
declare i32 @puts(i8*)
declare i32 @puts(ptr)
declare i32 @printf(i8*, ...)
declare i32 @printf(ptr, ...)

View File

@ -1,8 +1,8 @@
; RUN: opt -passes=adce -S < %s | not grep call
declare i32 @strlen(i8*) readonly nounwind willreturn
declare i32 @strlen(ptr) readonly nounwind willreturn
define void @test() {
call i32 @strlen( i8* null ) ; <i32>:1 [#uses=0]
call i32 @strlen( ptr null ) ; <i32>:1 [#uses=0]
ret void
}

View File

@ -1,17 +1,17 @@
; RUN: opt < %s -passes=adce -S | grep null
declare i32 @strlen(i8*) readnone
declare i32 @strlen(ptr) readnone
define i32 @test() personality i32 (...)* @__gxx_personality_v0 {
define i32 @test() personality ptr @__gxx_personality_v0 {
; invoke of pure function should not be deleted!
invoke i32 @strlen( i8* null ) readnone
invoke i32 @strlen( ptr null ) readnone
to label %Cont unwind label %Other ; <i32>:1 [#uses=0]
Cont: ; preds = %0
ret i32 0
Other: ; preds = %0
%exn = landingpad {i8*, i32}
%exn = landingpad {ptr, i32}
cleanup
ret i32 1
}

View File

@ -3,16 +3,16 @@
; Verify that a call to instrument a constant is deleted.
@__profc_foo = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8
@__profd_foo = private global { i64, i64, i64*, i8*, i8*, i32, [1 x i16] } { i64 6699318081062747564, i64 0, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i32 0, i32 0), i8* bitcast (i32 ()* @foo to i8*), i8* null, i32 1, [1 x i16] [i16 1] }, section "__llvm_prf_data", align 8
@__profd_foo = private global { i64, i64, ptr, ptr, ptr, i32, [1 x i16] } { i64 6699318081062747564, i64 0, ptr @__profc_foo, ptr @foo, ptr null, i32 1, [1 x i16] [i16 1] }, section "__llvm_prf_data", align 8
define i32 @foo() {
; CHECK-NOT: call void @__llvm_profile_instrument_target
entry:
tail call void @__llvm_profile_instrument_target(i64 ptrtoint (i32 (i32)* @bar to i64), i8* bitcast ({ i64, i64, i64*, i8*, i8*, i32, [1 x i16] }* @__profd_foo to i8*), i32 0)
tail call void @__llvm_profile_instrument_target(i64 ptrtoint (ptr @bar to i64), ptr @__profd_foo, i32 0)
%call = tail call i32 @bar(i32 21)
ret i32 %call
}
declare i32 @bar(i32)
declare void @__llvm_profile_instrument_target(i64, i8*, i32)
declare void @__llvm_profile_instrument_target(i64, ptr, i32)

View File

@ -11,13 +11,13 @@
define i32 @main() {
entry:
%retval = alloca i32, align 4
store i32 0, i32* %retval, align 4
%0 = load i32, i32* @a, align 4
store i32 0, ptr %retval, align 4
%0 = load i32, ptr @a, align 4
%cmp = icmp ne i32 %0, 1
br i1 %cmp, label %land.rhs, label %land.end4
land.rhs: ; preds = %entry
%1 = load i32, i32* @a, align 4
%1 = load i32, ptr @a, align 4
%tobool = icmp ne i32 %1, 0
br i1 %tobool, label %land.rhs1, label %land.end