mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-26 07:29:55 +00:00
clean up DSE tests, removing some poorly reduced and useless old test,
merging more into other larger .ll files, filecheckizing along the way. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120373 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0e45a5a901
commit
75aa30bb1c
@ -1,14 +0,0 @@
|
||||
; RUN: opt < %s -dse -scalarrepl -instcombine | \
|
||||
; RUN: llvm-dis | not grep {ret i32 undef}
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
; RUN: opt < %s -dse -S | \
|
||||
; RUN: grep {store i32 1234567}
|
||||
|
||||
; Do not delete stores that are only partially killed.
|
||||
|
||||
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
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
; RUN: opt < %s -dse -S | grep store
|
||||
|
||||
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
@ -1,15 +0,0 @@
|
||||
; RUN: opt < %s -basicaa -dse -S | not grep tmp5
|
||||
; PR2599
|
||||
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
|
||||
|
||||
define void @foo({ i32, i32 }* %x) nounwind {
|
||||
entry:
|
||||
%tmp4 = getelementptr { i32, i32 }* %x, i32 0, i32 0 ; <i32*> [#uses=2]
|
||||
%tmp5 = load i32* %tmp4, align 4 ; <i32> [#uses=1]
|
||||
%tmp7 = getelementptr { i32, i32 }* %x, i32 0, i32 1 ; <i32*> [#uses=2]
|
||||
%tmp8 = load i32* %tmp7, align 4 ; <i32> [#uses=1]
|
||||
%tmp17 = sub i32 0, %tmp8 ; <i32> [#uses=1]
|
||||
store i32 %tmp5, i32* %tmp4, align 4
|
||||
store i32 %tmp17, i32* %tmp7, align 4
|
||||
ret void
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
; RUN: opt < %s -dse | llvm-dis
|
||||
; PR3141
|
||||
%struct.ada__tags__dispatch_table = type { [1 x i32] }
|
||||
%struct.f393a00_1__object = type { %struct.ada__tags__dispatch_table*, i8 }
|
||||
%struct.f393a00_2__windmill = type { %struct.f393a00_1__object, i16 }
|
||||
|
||||
define void @f393a00_2__swap(%struct.f393a00_2__windmill* %a, %struct.f393a00_2__windmill* %b) {
|
||||
entry:
|
||||
%t = alloca %struct.f393a00_2__windmill ; <%struct.f393a00_2__windmill*> [#uses=1]
|
||||
%0 = getelementptr %struct.f393a00_2__windmill* %t, i32 0, i32 0, i32 0 ; <%struct.ada__tags__dispatch_table**> [#uses=1]
|
||||
%1 = load %struct.ada__tags__dispatch_table** null, align 4 ; <%struct.ada__tags__dispatch_table*> [#uses=1]
|
||||
%2 = load %struct.ada__tags__dispatch_table** %0, align 8 ; <%struct.ada__tags__dispatch_table*> [#uses=1]
|
||||
store %struct.ada__tags__dispatch_table* %2, %struct.ada__tags__dispatch_table** null, align 4
|
||||
store %struct.ada__tags__dispatch_table* %1, %struct.ada__tags__dispatch_table** null, align 4
|
||||
ret void
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
; RUN: opt < %s -dse | llvm-dis
|
||||
|
||||
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
|
||||
target triple = "i386-apple-darwin7"
|
||||
%struct.cab_archive = type { i32, i16, i16, i16, i16, i8, %struct.cab_folder*, %struct.cab_file* }
|
||||
%struct.cab_file = type { i32, i16, i64, i8*, i32, i32, i32, %struct.cab_folder*, %struct.cab_file*, %struct.cab_archive*, %struct.cab_state* }
|
||||
%struct.cab_folder = type { i16, i16, %struct.cab_archive*, i64, %struct.cab_folder* }
|
||||
%struct.cab_state = type { i8*, i8*, [38912 x i8], i16, i16, i8*, i16 }
|
||||
%struct.lzx_stream = type { i32, i32, i8, i64, i64, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i8, i32, i8*, i8*, i8*, i8*, i8*, i32, i32, i32, [84 x i8], [720 x i8], [314 x i8], [72 x i8], [104 x i16], [5408 x i16], [4596 x i16], [144 x i16], [51 x i32], [51 x i8], [32768 x i8], %struct.cab_file*, i32 (%struct.cab_file*, i8*, i32)* }
|
||||
|
||||
declare fastcc i32 @lzx_read_lens(%struct.lzx_stream*, i8*, i32, i32) nounwind
|
||||
|
||||
define i32 @lzx_decompress(%struct.lzx_stream* %lzx, i64 %out_bytes) nounwind {
|
||||
bb13: ; preds = %entry
|
||||
%0 = getelementptr %struct.lzx_stream* %lzx, i32 0, i32 25 ; <i8**> [#uses=2]
|
||||
%1 = getelementptr %struct.lzx_stream* %lzx, i32 0, i32 26 ; <i8**> [#uses=2]
|
||||
%2 = getelementptr %struct.lzx_stream* %lzx, i32 0, i32 29 ; <i32*> [#uses=0]
|
||||
br label %bb14
|
||||
|
||||
bb14: ; preds = %bb13
|
||||
%3 = load i8** %0, align 4 ; <i8*> [#uses=1]
|
||||
%4 = load i8** %1, align 4 ; <i8*> [#uses=1]
|
||||
store i8* %3, i8** %0, align 4
|
||||
store i8* %4, i8** %1, align 4
|
||||
%5 = call fastcc i32 @lzx_read_lens(%struct.lzx_stream* %lzx, i8* null, i32 256, i32 0) nounwind ; <i32> [#uses=0]
|
||||
unreachable
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
; RUN: opt -S -dse < %s | FileCheck %s
|
||||
|
||||
declare i8* @llvm.init.trampoline(i8*, i8*, i8*)
|
||||
|
||||
declare void @f()
|
||||
|
||||
define void @unused_trampoline() {
|
||||
; CHECK: @unused_trampoline
|
||||
%storage = alloca [10 x i8], align 16 ; <[10 x i8]*> [#uses=1]
|
||||
; CHECK-NOT: alloca
|
||||
%cast = getelementptr [10 x i8]* %storage, i32 0, i32 0 ; <i8*> [#uses=1]
|
||||
%tramp = call i8* @llvm.init.trampoline( i8* %cast, i8* bitcast (void ()* @f to i8*), i8* null ) ; <i8*> [#uses=1]
|
||||
; CHECK-NOT: trampoline
|
||||
ret void
|
||||
; CHECK: ret void
|
||||
}
|
@ -1,14 +1,38 @@
|
||||
; RUN: opt < %s -basicaa -dse -S | \
|
||||
; RUN: not grep {store i8}
|
||||
; RUN: opt < %s -basicaa -dse -S | FileCheck %s
|
||||
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
|
||||
|
||||
; Ensure that the dead store is deleted in this case. It is wholely
|
||||
; overwritten by the second store.
|
||||
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
|
||||
define i32 @test() {
|
||||
%V = alloca i32 ; <i32*> [#uses=3]
|
||||
define void @test1(i32 *%V) {
|
||||
%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
|
||||
ret void
|
||||
; CHECK: @test1
|
||||
; CHECK-NEXT: store i32 1234567
|
||||
}
|
||||
|
||||
; Note that we could do better by merging the two stores into one.
|
||||
define void @test2(i32* %P) {
|
||||
; CHECK: @test2
|
||||
store i32 0, i32* %P
|
||||
; CHECK: store i32
|
||||
%Q = bitcast i32* %P to i16*
|
||||
store i16 1, i16* %Q
|
||||
; CHECK: store i16
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
define i32 @test3(double %__x) {
|
||||
; CHECK: @test3
|
||||
; CHECK: store double
|
||||
%__u = alloca { [3 x i32] }
|
||||
%tmp.1 = bitcast { [3 x i32] }* %__u to double*
|
||||
store double %__x, double* %tmp.1
|
||||
%tmp.4 = getelementptr { [3 x i32] }* %__u, i32 0, i32 0, i32 1
|
||||
%tmp.5 = load i32* %tmp.4
|
||||
%tmp.6 = icmp slt i32 %tmp.5, 0
|
||||
%tmp.7 = zext i1 %tmp.6 to i32
|
||||
ret i32 %tmp.7
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
; RUN: opt < %s -dse -S | not grep store
|
||||
|
||||
%struct.x = type { i32, i32, i32, i32 }
|
||||
|
||||
define i32 @foo(%struct.x* byval %a) nounwind {
|
||||
entry:
|
||||
%tmp2 = getelementptr %struct.x* %a, i32 0, i32 0
|
||||
store i32 1, i32* %tmp2, align 4
|
||||
ret i32 1
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
; RUN: opt < %s -dse -S
|
||||
; RUN: opt < %s -basicaa -dse -S
|
||||
|
||||
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
|
||||
target triple = "i386-apple-darwin10.0"
|
||||
@ -55,3 +55,20 @@ dead:
|
||||
store i32 4, i32* %Q2
|
||||
br label %dead
|
||||
}
|
||||
|
||||
|
||||
; PR3141
|
||||
%struct.ada__tags__dispatch_table = type { [1 x i32] }
|
||||
%struct.f393a00_1__object = type { %struct.ada__tags__dispatch_table*, i8 }
|
||||
%struct.f393a00_2__windmill = type { %struct.f393a00_1__object, i16 }
|
||||
|
||||
define void @test4(%struct.f393a00_2__windmill* %a, %struct.f393a00_2__windmill* %b) {
|
||||
entry:
|
||||
%t = alloca %struct.f393a00_2__windmill ; <%struct.f393a00_2__windmill*> [#uses=1]
|
||||
%0 = getelementptr %struct.f393a00_2__windmill* %t, i32 0, i32 0, i32 0 ; <%struct.ada__tags__dispatch_table**> [#uses=1]
|
||||
%1 = load %struct.ada__tags__dispatch_table** null, align 4 ; <%struct.ada__tags__dispatch_table*> [#uses=1]
|
||||
%2 = load %struct.ada__tags__dispatch_table** %0, align 8 ; <%struct.ada__tags__dispatch_table*> [#uses=1]
|
||||
store %struct.ada__tags__dispatch_table* %2, %struct.ada__tags__dispatch_table** null, align 4
|
||||
store %struct.ada__tags__dispatch_table* %1, %struct.ada__tags__dispatch_table** null, align 4
|
||||
ret void
|
||||
}
|
||||
|
@ -1,52 +0,0 @@
|
||||
; RUN: opt < %s -dse -S | not grep alloca
|
||||
; ModuleID = 'placeholder.adb'
|
||||
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
|
||||
target triple = "i686-pc-linux-gnu"
|
||||
%struct.placeholder__T5b = type { i32, [1 x i32] }
|
||||
%struct.placeholder__an_interval___PAD = type { %struct.placeholder__interval, [4 x i32] }
|
||||
%struct.placeholder__interval = type { i32, i32 }
|
||||
%struct.placeholder__s__s__the_interval___PAD = type { %struct.placeholder__interval }
|
||||
|
||||
define void @_ada_placeholder() nounwind {
|
||||
entry:
|
||||
%an_interval = alloca %struct.placeholder__an_interval___PAD ; <%struct.placeholder__an_interval___PAD*> [#uses=3]
|
||||
%tmp34 = bitcast %struct.placeholder__an_interval___PAD* %an_interval to %struct.placeholder__T5b* ; <%struct.placeholder__T5b*> [#uses=1]
|
||||
%tmp5 = getelementptr %struct.placeholder__an_interval___PAD* %an_interval, i32 0, i32 0, i32 0 ; <i32*> [#uses=2]
|
||||
store i32 1, i32* %tmp5, align 8
|
||||
%tmp10 = getelementptr %struct.placeholder__T5b* %tmp34, i32 0, i32 1, i32 0 ; <i32*> [#uses=1]
|
||||
store i32 1, i32* %tmp10, align 4
|
||||
%tmp82 = load i32* %tmp5, align 8 ; <i32> [#uses=5]
|
||||
%tmp83 = icmp slt i32 %tmp82, 6 ; <i1> [#uses=1]
|
||||
%min84 = select i1 %tmp83, i32 %tmp82, i32 5 ; <i32> [#uses=3]
|
||||
%tmp85 = icmp sgt i32 %min84, -1 ; <i1> [#uses=2]
|
||||
%min84.cast193 = zext i32 %min84 to i64 ; <i64> [#uses=1]
|
||||
%min84.cast193.op = shl i64 %min84.cast193, 33 ; <i64> [#uses=1]
|
||||
%tmp104 = icmp sgt i32 %tmp82, -1 ; <i1> [#uses=2]
|
||||
%tmp103.cast192 = zext i32 %tmp82 to i64 ; <i64> [#uses=1]
|
||||
%tmp103.cast192.op = shl i64 %tmp103.cast192, 33 ; <i64> [#uses=1]
|
||||
%min84.cast193.op.op = ashr i64 %min84.cast193.op, 28 ; <i64> [#uses=1]
|
||||
%sextr121 = select i1 %tmp85, i64 %min84.cast193.op.op, i64 0 ; <i64> [#uses=2]
|
||||
%tmp103.cast192.op.op = ashr i64 %tmp103.cast192.op, 28 ; <i64> [#uses=1]
|
||||
%sextr123 = select i1 %tmp104, i64 %tmp103.cast192.op.op, i64 0 ; <i64> [#uses=2]
|
||||
%tmp124 = icmp sle i64 %sextr121, %sextr123 ; <i1> [#uses=1]
|
||||
%min125 = select i1 %tmp124, i64 %sextr121, i64 %sextr123 ; <i64> [#uses=1]
|
||||
%sextr131194 = and i64 %min125, 34359738336 ; <i64> [#uses=1]
|
||||
%tmp134 = add i64 %sextr131194, 63 ; <i64> [#uses=1]
|
||||
lshr i64 %tmp134, 3 ; <i64>:0 [#uses=1]
|
||||
%tmp150188.shrunk = trunc i64 %0 to i32 ; <i32> [#uses=1]
|
||||
%tmp159 = and i32 %tmp150188.shrunk, -4 ; <i32> [#uses=1]
|
||||
%tmp161 = alloca i8, i32 %tmp159 ; <i8*> [#uses=1]
|
||||
%min167.op = shl i32 %min84, 2 ; <i32> [#uses=1]
|
||||
%tmp170 = select i1 %tmp85, i32 %min167.op, i32 0 ; <i32> [#uses=2]
|
||||
%tmp173.op = shl i32 %tmp82, 2 ; <i32> [#uses=1]
|
||||
%tmp176 = select i1 %tmp104, i32 %tmp173.op, i32 0 ; <i32> [#uses=2]
|
||||
%tmp177 = icmp sle i32 %tmp170, %tmp176 ; <i1> [#uses=1]
|
||||
%min178 = select i1 %tmp177, i32 %tmp170, i32 %tmp176 ; <i32> [#uses=1]
|
||||
%tmp179 = add i32 %min178, 7 ; <i32> [#uses=1]
|
||||
%tmp180 = and i32 %tmp179, -4 ; <i32> [#uses=1]
|
||||
%tmp183185 = bitcast %struct.placeholder__an_interval___PAD* %an_interval to i8* ; <i8*> [#uses=1]
|
||||
call void @llvm.memcpy.i32( i8* %tmp161, i8* %tmp183185, i32 %tmp180, i32 4 )
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
|
@ -79,3 +79,69 @@ define void @test7(i32 *%p, i8 *%q, i8* noalias %r) {
|
||||
; CHECK: @test7
|
||||
; CHECK-NEXT: call void @llvm.memcpy
|
||||
}
|
||||
|
||||
; Do not delete stores that are only partially killed.
|
||||
define i32 @test8() {
|
||||
%V = alloca i32
|
||||
store i32 1234567, i32* %V
|
||||
%V2 = bitcast i32* %V to i8*
|
||||
store i8 0, i8* %V2
|
||||
%X = load i32* %V
|
||||
ret i32 %X
|
||||
|
||||
; CHECK: @test8
|
||||
; CHECK: store i32 1234567
|
||||
}
|
||||
|
||||
|
||||
; Test for byval handling.
|
||||
%struct.x = type { i32, i32, i32, i32 }
|
||||
define void @test9(%struct.x* byval %a) nounwind {
|
||||
%tmp2 = getelementptr %struct.x* %a, i32 0, i32 0
|
||||
store i32 1, i32* %tmp2, align 4
|
||||
ret void
|
||||
; CHECK: @test9
|
||||
; CHECK-NEXT: ret void
|
||||
}
|
||||
|
||||
; va_arg has fuzzy dependence, the store shouldn't be zapped.
|
||||
define double @test10(i8* %X) {
|
||||
%X_addr = alloca i8*
|
||||
store i8* %X, i8** %X_addr
|
||||
%tmp.0 = va_arg i8** %X_addr, double
|
||||
ret double %tmp.0
|
||||
; CHECK: @test10
|
||||
; CHECK: store
|
||||
}
|
||||
|
||||
|
||||
; DSE should delete the dead trampoline.
|
||||
declare i8* @llvm.init.trampoline(i8*, i8*, i8*)
|
||||
declare void @test11f()
|
||||
define void @test11() {
|
||||
; CHECK: @test11
|
||||
%storage = alloca [10 x i8], align 16 ; <[10 x i8]*> [#uses=1]
|
||||
; CHECK-NOT: alloca
|
||||
%cast = getelementptr [10 x i8]* %storage, i32 0, i32 0 ; <i8*> [#uses=1]
|
||||
%tramp = call i8* @llvm.init.trampoline( i8* %cast, i8* bitcast (void ()* @test11f to i8*), i8* null ) ; <i8*> [#uses=1]
|
||||
; CHECK-NOT: trampoline
|
||||
ret void
|
||||
; CHECK: ret void
|
||||
}
|
||||
|
||||
|
||||
; PR2599 - load -> store to same address.
|
||||
define void @test12({ i32, i32 }* %x) nounwind {
|
||||
%tmp4 = getelementptr { i32, i32 }* %x, i32 0, i32 0
|
||||
%tmp5 = load i32* %tmp4, align 4
|
||||
%tmp7 = getelementptr { i32, i32 }* %x, i32 0, i32 1
|
||||
%tmp8 = load i32* %tmp7, align 4
|
||||
%tmp17 = sub i32 0, %tmp8
|
||||
store i32 %tmp5, i32* %tmp4, align 4
|
||||
store i32 %tmp17, i32* %tmp7, align 4
|
||||
ret void
|
||||
; CHECK: @test12
|
||||
; CHECK-NOT: tmp5
|
||||
; CHECK: ret void
|
||||
}
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
; RUN: opt < %s -dse -S | grep {volatile load}
|
||||
|
||||
@g_1 = global i32 0
|
||||
|
||||
define void @foo() nounwind {
|
||||
%t = volatile load i32* @g_1
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user