mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-18 11:20:03 +00:00
GlobalOpt: Convert a bunch of tests from grep to FileCheck
llvm-svn: 267493
This commit is contained in:
parent
4f931e53db
commit
504105c02c
@ -1,6 +1,8 @@
|
||||
; RUN: opt < %s -globalopt -S | grep "16 x .31 x double.. zeroinitializer"
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
|
||||
; The 'X' indices could be larger than 31. Do not SROA the outer indices of this array.
|
||||
; The 'X' indices could be larger than 31. Do not SROA the outer
|
||||
; indices of this array.
|
||||
; CHECK: @mm = {{.*}} [16 x [31 x double]] zeroinitializer
|
||||
@mm = internal global [16 x [31 x double]] zeroinitializer, align 32
|
||||
|
||||
define void @test(i32 %X) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt < %s -globalopt -S | grep "load volatile"
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
; CHECK: load volatile
|
||||
@t0.1441 = internal global double 0x3FD5555555555555, align 8 ; <double*> [#uses=1]
|
||||
|
||||
define double @foo() nounwind {
|
||||
|
@ -2,9 +2,11 @@
|
||||
; alignments. Elements 0 and 2 must be 16-byte aligned, and element
|
||||
; 1 must be at least 8 byte aligned (but could be more).
|
||||
|
||||
; RUN: opt < %s -globalopt -S | grep "@G.0 = internal unnamed_addr global .*align 16"
|
||||
; RUN: opt < %s -globalopt -S | grep "@G.1 = internal unnamed_addr global .*align 8"
|
||||
; RUN: opt < %s -globalopt -S | grep "@G.2 = internal unnamed_addr global .*align 16"
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
; CHECK: @G.0 = internal unnamed_addr global {{.*}}align 16
|
||||
; CHECK: @G.1 = internal unnamed_addr global {{.*}}align 8
|
||||
; CHECK: @G.2 = internal unnamed_addr global {{.*}}align 16
|
||||
|
||||
; rdar://5891920
|
||||
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
||||
|
@ -2,9 +2,11 @@
|
||||
; values. This used to crash, because globalopt forgot to put the new var in the
|
||||
; same address space as the old one.
|
||||
|
||||
; RUN: opt < %s -globalopt -S > %t
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
|
||||
; Check that the new global values still have their address space
|
||||
; RUN: cat %t | grep 'addrspace.*global'
|
||||
; CHECK: addrspace(1) global
|
||||
; CHECK: addrspace(1) global
|
||||
|
||||
@struct = internal addrspace(1) global { i32, i32 } zeroinitializer
|
||||
@array = internal addrspace(1) global [ 2 x i32 ] zeroinitializer
|
||||
@ -24,5 +26,3 @@ define void @bar(i32 %R) {
|
||||
store i32 %R, i32 addrspace(1) * getelementptr ({ i32, i32 }, { i32, i32 } addrspace(1) * @struct, i32 0, i32 0)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt < %s -globalopt -S | grep "phi.*@head"
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
; CHECK: phi{{.*}}@head
|
||||
; PR3321
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
@ -1,5 +1,6 @@
|
||||
; REQUIRES: asserts
|
||||
; RUN: opt < %s -globalopt -stats -disable-output 2>&1 | grep "1 globalopt - Number of global vars shrunk to booleans"
|
||||
; RUN: opt < %s -globalopt -stats -disable-output 2>&1 | FileCheck %s
|
||||
; CHECK: 1 globalopt - Number of global vars shrunk to booleans
|
||||
|
||||
@Stop = internal global i32 0 ; <i32*> [#uses=3]
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
; RUN: opt < %s -globalopt -S | grep "@X = internal unnamed_addr global i32"
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %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-darwin7"
|
||||
|
||||
; CHECK: @X = internal unnamed_addr global i32
|
||||
@X = internal global i32* null ; <i32**> [#uses=2]
|
||||
@Y = internal global i32 0 ; <i32*> [#uses=1]
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
; RUN: opt < %s -globalopt -S | not grep global
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
|
||||
; CHECK-NOT: global
|
||||
@X = internal global i32 4 ; <i32*> [#uses=1]
|
||||
|
||||
define i32 @foo() {
|
||||
%V = load i32, i32* @X ; <i32> [#uses=1]
|
||||
ret i32 %V
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
; RUN: opt < %s -instcombine -globalopt -S | \
|
||||
; RUN: grep "internal fastcc float @foo"
|
||||
; RUN: opt < %s -instcombine -globalopt -S | FileCheck %s
|
||||
; CHECK: internal fastcc float @foo
|
||||
|
||||
define internal float @foo() {
|
||||
ret float 0.000000e+00
|
||||
@ -10,4 +10,3 @@ define float @bar() {
|
||||
%tmp2 = fmul float %tmp1, 1.000000e+01 ; <float> [#uses=1]
|
||||
ret float %tmp2
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
; RUN: opt < %s -globalopt -S | not grep internal
|
||||
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
; This is a harder case to delete as the GEP has a variable index.
|
||||
|
||||
; CHECK-NOT: internal
|
||||
@G = internal global [4 x i32] zeroinitializer
|
||||
|
||||
define void @foo(i32 %X) {
|
||||
|
@ -1,10 +1,11 @@
|
||||
; In this case, the global can only be broken up by one level.
|
||||
|
||||
; RUN: opt < %s -globalopt -S | not grep 12345
|
||||
; RUN: opt < %s -globalopt -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"
|
||||
|
||||
@G = internal global { i32, [4 x float] } zeroinitializer ; <{ i32, [4 x float] }*> [#uses=3]
|
||||
|
||||
; CHECK-NOT: 12345
|
||||
define void @onlystore() {
|
||||
store i32 12345, i32* getelementptr ({ i32, [4 x float] }, { i32, [4 x float] }* @G, i32 0, i32 0)
|
||||
ret void
|
||||
@ -21,4 +22,3 @@ define float @readval(i32 %i) {
|
||||
%V = load float, float* %Ptr ; <float> [#uses=1]
|
||||
ret float %V
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
; RUN: opt < %s -globalopt -S > %t
|
||||
; RUN: grep "@Y = internal unnamed_addr global \[3 x [%]struct.X\] zeroinitializer" %t
|
||||
; RUN: grep load %t | count 6
|
||||
; RUN: grep "add i32 [%]a, [%]b" %t | count 3
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
|
||||
; globalopt should not sra the global, because it can't see the index.
|
||||
|
||||
%struct.X = type { [3 x i32], [3 x i32] }
|
||||
|
||||
; CHECK: @Y = internal unnamed_addr global [3 x %struct.X] zeroinitializer
|
||||
@Y = internal global [3 x %struct.X] zeroinitializer
|
||||
|
||||
@addr = external global i8
|
||||
@ -15,6 +13,11 @@ define void @frob() {
|
||||
store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 ptrtoint (i8* @addr to i64)), align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK-LABEL: @borf
|
||||
; CHECK: %a = load
|
||||
; CHECK: %b = load
|
||||
; CHECK: add i32 %a, %b
|
||||
define i32 @borf(i64 %i, i64 %j) {
|
||||
%p = getelementptr inbounds [3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0
|
||||
%a = load i32, i32* %p
|
||||
@ -23,6 +26,11 @@ define i32 @borf(i64 %i, i64 %j) {
|
||||
%c = add i32 %a, %b
|
||||
ret i32 %c
|
||||
}
|
||||
|
||||
; CHECK-LABEL: @borg
|
||||
; CHECK: %a = load
|
||||
; CHECK: %b = load
|
||||
; CHECK: add i32 %a, %b
|
||||
define i32 @borg(i64 %i, i64 %j) {
|
||||
%p = getelementptr inbounds [3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 1
|
||||
%a = load i32, i32* %p
|
||||
@ -31,6 +39,11 @@ define i32 @borg(i64 %i, i64 %j) {
|
||||
%c = add i32 %a, %b
|
||||
ret i32 %c
|
||||
}
|
||||
|
||||
; CHECK-LABEL: @borh
|
||||
; CHECK: %a = load
|
||||
; CHECK: %b = load
|
||||
; CHECK: add i32 %a, %b
|
||||
define i32 @borh(i64 %i, i64 %j) {
|
||||
%p = getelementptr inbounds [3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 2
|
||||
%a = load i32, i32* %p
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt < %s -globalopt -S | not grep global
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
; CHECK-NOT: global
|
||||
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"
|
||||
|
||||
@G = internal global { i32, float, { double } } {
|
||||
@ -42,4 +43,3 @@ define double @constantize2() {
|
||||
%X = load double, double* getelementptr ({ i32, float, { double } }, { i32, float, { double } }* @G2, i32 0, i32 2, i32 0) ; <double> [#uses=1]
|
||||
ret double %X
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
; RUN: opt < %s -globalopt -S | grep "tmp.f1 = phi i32. "
|
||||
; RUN: opt < %s -globalopt -S | grep "tmp.f0 = phi i32. "
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
; CHECK: tmp.f1 = phi i32*
|
||||
; CHECK: tmp.f0 = phi i32*
|
||||
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"
|
||||
|
||||
%struct.foo = type { i32, i32 }
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt < %s -globalopt -S | not grep %G
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
; CHECK-NOT: %G
|
||||
|
||||
@G = internal global i32 0 ; <i32*> [#uses=1]
|
||||
@H = internal global { i32* } { i32* @G } ; <{ i32* }*> [#uses=1]
|
||||
@ -8,4 +9,3 @@ define i32 @loadg() {
|
||||
%GV = load i32, i32* %G ; <i32> [#uses=1]
|
||||
ret i32 %GV
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
; RUN: opt < %s -globalopt -S | \
|
||||
; RUN: grep "G1 = internal unnamed_addr constant"
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
; CHECK: G1 = internal unnamed_addr constant
|
||||
|
||||
@G1 = internal global [58 x i8] c"asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd\00" ; <[58 x i8]*> [#uses=1]
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
; Test that PHI nodes and select instructions do not necessarily make stuff
|
||||
; non-constant.
|
||||
|
||||
; RUN: opt < %s -globalopt -S | not grep global
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
; CHECK-NOT: global
|
||||
|
||||
@X = internal global i32 4 ; <i32*> [#uses=2]
|
||||
@Y = internal global i32 5 ; <i32*> [#uses=2]
|
||||
@ -24,8 +25,3 @@ Cont: ; preds = %T, %0
|
||||
%V = load i32, i32* %P ; <i32> [#uses=1]
|
||||
ret i32 %V
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
; RUN: opt < %s -globalopt -S | \
|
||||
; RUN: grep "call void @Actual"
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
; CHECK: call void @Actual
|
||||
|
||||
; Check that a comparison does not prevent an indirect call from being made
|
||||
; direct. The global will still remain, but indirect call elim is still good.
|
||||
@ -27,4 +27,3 @@ DoCall: ; preds = %0
|
||||
isNull: ; preds = %0
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt < %s -globalopt -S | not grep global
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
; CHECK-NOT: global
|
||||
|
||||
@G = internal global void ()* null ; <void ()**> [#uses=2]
|
||||
|
||||
@ -16,4 +17,3 @@ define void @doit() {
|
||||
call void %FP( )
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt < %s -globalopt -S | not grep G
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
; CHECK-NOT: G
|
||||
|
||||
@G = internal global i32 17 ; <i32*> [#uses=3]
|
||||
|
||||
@ -16,4 +17,3 @@ define internal void @dead() {
|
||||
store i32 123, i32* @G
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt < %s -globalopt -S | not grep store
|
||||
; RUN: opt < %s -globalopt -S | FileCheck %s
|
||||
; CHECK-NOT: store
|
||||
|
||||
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__Z3foov } ] ; <[1 x { i32, void ()* }]*> [#uses=0]
|
||||
@X.0 = internal global i32 undef ; <i32*> [#uses=2]
|
||||
@ -14,4 +15,3 @@ entry:
|
||||
store i32 1, i32* @X.0
|
||||
ret void
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user