forked from OSchip/llvm-project
[test][GlobalOpt] Regenerate some tests
This commit is contained in:
parent
f61f7be0c7
commit
9fac606af2
|
@ -1,31 +1,43 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
|
||||
; RUN: opt < %s -passes=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* null ; <i32**> [#uses=3]
|
||||
; CHECK: global
|
||||
|
||||
;.
|
||||
; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal unnamed_addr global i32* null
|
||||
;.
|
||||
define void @init() #0 {
|
||||
; CHECK-LABEL: @init(
|
||||
; CHECK: store
|
||||
; CHECK: load
|
||||
%malloccall = tail call i8* @malloc(i64 4) ; <i8*> [#uses=1]
|
||||
%P = bitcast i8* %malloccall to i32* ; <i32*> [#uses=1]
|
||||
store i32* %P, i32** @G
|
||||
%GV = load i32*, i32** @G ; <i32*> [#uses=1]
|
||||
store i32 0, i32* %GV
|
||||
ret void
|
||||
; CHECK-NEXT: [[MALLOCCALL:%.*]] = tail call i8* @malloc(i64 4)
|
||||
; CHECK-NEXT: [[P:%.*]] = bitcast i8* [[MALLOCCALL]] to i32*
|
||||
; CHECK-NEXT: store i32* [[P]], i32** @G, align 8
|
||||
; CHECK-NEXT: [[GV:%.*]] = load i32*, i32** @G, align 8
|
||||
; CHECK-NEXT: store i32 0, i32* [[GV]], align 4
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
%malloccall = tail call i8* @malloc(i64 4)
|
||||
%P = bitcast i8* %malloccall to i32*
|
||||
store i32* %P, i32** @G
|
||||
%GV = load i32*, i32** @G
|
||||
store i32 0, i32* %GV
|
||||
ret void
|
||||
}
|
||||
|
||||
declare noalias i8* @malloc(i64)
|
||||
|
||||
define i32 @get() #0 {
|
||||
; CHECK-LABEL: @get(
|
||||
; CHECK: load i32*, i32** @G
|
||||
; CHECK-NEXT: load i32, i32* %GV
|
||||
%GV = load i32*, i32** @G ; <i32*> [#uses=1]
|
||||
%V = load i32, i32* %GV ; <i32> [#uses=1]
|
||||
ret i32 %V
|
||||
; CHECK: ret i32 %V
|
||||
; CHECK-NEXT: [[GV:%.*]] = load i32*, i32** @G, align 8
|
||||
; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[GV]], align 4
|
||||
; CHECK-NEXT: ret i32 [[V]]
|
||||
;
|
||||
%GV = load i32*, i32** @G
|
||||
%V = load i32, i32* %GV
|
||||
ret i32 %V
|
||||
}
|
||||
|
||||
attributes #0 = { null_pointer_is_valid }
|
||||
;.
|
||||
; CHECK: attributes #[[ATTR0:[0-9]+]] = { null_pointer_is_valid }
|
||||
;.
|
||||
|
|
|
@ -1,32 +1,44 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
|
||||
; RUN: opt < %s -passes=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* null ; <i32**> [#uses=4]
|
||||
; CHECK-NOT: global
|
||||
@G = internal global i32* null
|
||||
|
||||
define void @init() {
|
||||
%malloccall = tail call i8* @malloc(i64 4) ; <i8*> [#uses=1]
|
||||
%P = bitcast i8* %malloccall to i32* ; <i32*> [#uses=1]
|
||||
store i32* %P, i32** @G
|
||||
%GV = load i32*, i32** @G ; <i32*> [#uses=1]
|
||||
store i32 0, i32* %GV
|
||||
ret void
|
||||
; CHECK-LABEL: @init(
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
%malloccall = tail call i8* @malloc(i64 4)
|
||||
%P = bitcast i8* %malloccall to i32*
|
||||
store i32* %P, i32** @G
|
||||
%GV = load i32*, i32** @G
|
||||
store i32 0, i32* %GV
|
||||
ret void
|
||||
}
|
||||
|
||||
declare noalias i8* @malloc(i64)
|
||||
|
||||
define i32 @get() {
|
||||
%GV = load i32*, i32** @G ; <i32*> [#uses=1]
|
||||
%V = load i32, i32* %GV ; <i32> [#uses=1]
|
||||
ret i32 %V
|
||||
; CHECK: ret i32 0
|
||||
; CHECK-LABEL: @get(
|
||||
; CHECK-NEXT: ret i32 0
|
||||
;
|
||||
%GV = load i32*, i32** @G
|
||||
%V = load i32, i32* %GV
|
||||
ret i32 %V
|
||||
}
|
||||
|
||||
define void @foo(i64 %Size) nounwind noinline #0 {
|
||||
; CHECK-LABEL: @foo(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
%0 = load i32*, i32** @G, align 4
|
||||
ret void
|
||||
%0 = load i32*, i32** @G, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { null_pointer_is_valid }
|
||||
|
||||
;.
|
||||
; CHECK: attributes #[[ATTR0:[0-9]+]] = { noinline nounwind null_pointer_is_valid }
|
||||
;.
|
||||
|
|
|
@ -1,16 +1,22 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
|
||||
; RUN: opt < %s -passes=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* null
|
||||
|
||||
;.
|
||||
; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal unnamed_addr global i32* null
|
||||
;.
|
||||
define void @t() #0 {
|
||||
; CHECK: @t()
|
||||
; CHECK: call i8* @malloc
|
||||
; CHECK: bitcast
|
||||
; CHECK: store
|
||||
; CHECK: load
|
||||
; CHECK: getelementptr
|
||||
; CHECK: store
|
||||
; CHECK-LABEL: @t(
|
||||
; CHECK-NEXT: [[MALLOCCALL:%.*]] = tail call i8* @malloc(i64 400)
|
||||
; CHECK-NEXT: [[P:%.*]] = bitcast i8* [[MALLOCCALL]] to i32*
|
||||
; CHECK-NEXT: store i32* [[P]], i32** @G, align 8
|
||||
; CHECK-NEXT: [[GV:%.*]] = load i32*, i32** @G, align 8
|
||||
; CHECK-NEXT: [[GVE:%.*]] = getelementptr i32, i32* [[GV]], i32 40
|
||||
; CHECK-NEXT: store i32 20, i32* [[GVE]], align 4
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
%malloccall = tail call i8* @malloc(i64 mul (i64 100, i64 4))
|
||||
%P = bitcast i8* %malloccall to i32*
|
||||
store i32* %P, i32** @G
|
||||
|
@ -22,3 +28,6 @@ define void @t() #0 {
|
|||
|
||||
declare noalias i8* @malloc(i64)
|
||||
attributes #0 = { null_pointer_is_valid }
|
||||
;.
|
||||
; CHECK: attributes #[[ATTR0:[0-9]+]] = { null_pointer_is_valid }
|
||||
;.
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
|
||||
; RUN: opt < %s -passes=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* null
|
||||
|
||||
define void @t() {
|
||||
; CHECK: @t()
|
||||
; CHECK-NOT: call i8* @malloc
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK-LABEL: @t(
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
%malloccall = tail call i8* @malloc(i64 mul (i64 100, i64 4))
|
||||
%P = bitcast i8* %malloccall to i32*
|
||||
store i32* %P, i32** @G
|
||||
|
@ -19,9 +20,16 @@ define void @t() {
|
|||
declare noalias i8* @malloc(i64)
|
||||
|
||||
define void @foo(i64 %Size) nounwind noinline #0 {
|
||||
; CHECK-LABEL: @foo(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
%0 = load i32*, i32** @G, align 4
|
||||
ret void
|
||||
%0 = load i32*, i32** @G, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { null_pointer_is_valid }
|
||||
;.
|
||||
; CHECK: attributes #[[ATTR0:[0-9]+]] = { noinline nounwind null_pointer_is_valid }
|
||||
;.
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
|
||||
; RUN: opt < %s -passes=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* null
|
||||
|
||||
;.
|
||||
; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal unnamed_addr global i32* null
|
||||
;.
|
||||
define void @t() {
|
||||
; CHECK: @t()
|
||||
; CHECK: call i8* @malloc
|
||||
; CHECK-LABEL: @t(
|
||||
; CHECK-NEXT: [[MALLOCCALL:%.*]] = tail call i8* @malloc(i64 400) #[[ATTR0:[0-9]+]]
|
||||
; CHECK-NEXT: [[P:%.*]] = bitcast i8* [[MALLOCCALL]] to i32*
|
||||
; CHECK-NEXT: store i32* [[P]], i32** @G, align 8
|
||||
; CHECK-NEXT: [[GV:%.*]] = load i32*, i32** @G, align 8
|
||||
; CHECK-NEXT: [[GVE:%.*]] = getelementptr i32, i32* [[GV]], i32 40
|
||||
; CHECK-NEXT: store i32 20, i32* [[GVE]], align 4
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
%malloccall = tail call i8* @malloc(i64 mul (i64 100, i64 4)) nobuiltin
|
||||
%P = bitcast i8* %malloccall to i32*
|
||||
store i32* %P, i32** @G
|
||||
|
@ -16,3 +27,6 @@ define void @t() {
|
|||
}
|
||||
|
||||
declare noalias i8* @malloc(i64)
|
||||
;.
|
||||
; CHECK: attributes #[[ATTR0]] = { nobuiltin }
|
||||
;.
|
||||
|
|
|
@ -1,15 +1,25 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-globals
|
||||
; RUN: opt -S -passes=globalopt -o - < %s | FileCheck %s
|
||||
|
||||
; CHECK: [[G_INIT:@.*]] = internal unnamed_addr global i1 false
|
||||
@g = internal global i32* null, align 8
|
||||
|
||||
; CHECK-LABEL: define {{.*}} @f1(
|
||||
; CHECK-NEXT: [[G_INIT_VAL:%.*]] = load i1, i1* [[G_INIT]], align 1
|
||||
;.
|
||||
; CHECK: @[[G_INIT:[a-zA-Z0-9_$"\\.-]+]] = internal unnamed_addr global i1 false
|
||||
;.
|
||||
define internal i32 @f1() {
|
||||
; CHECK-LABEL: define {{[^@]+}}@f1() unnamed_addr {
|
||||
; CHECK-NEXT: [[G_INIT_VAL:%.*]] = load i1, i1* @g.init, align 1
|
||||
; CHECK-NEXT: call fastcc void @f2()
|
||||
; CHECK-NEXT: [[NOTINIT:%.*]] = xor i1 [[G_INIT_VAL]], true
|
||||
; CHECK-NEXT: br i1 [[NOTINIT]], label [[TMP1:%.*]], label [[TMP2:%.*]]
|
||||
; CHECK: 1:
|
||||
; CHECK-NEXT: br label [[TMP3:%.*]]
|
||||
; CHECK: 2:
|
||||
; CHECK-NEXT: br label [[TMP3]]
|
||||
; CHECK: 3:
|
||||
; CHECK-NEXT: [[TMP4:%.*]] = phi i32 [ -1, [[TMP1]] ], [ 1, [[TMP2]] ]
|
||||
; CHECK-NEXT: ret i32 [[TMP4]]
|
||||
;
|
||||
define internal i32 @f1() {
|
||||
%1 = load i32*, i32** @g, align 8
|
||||
call void @f2();
|
||||
%2 = icmp eq i32* %1, null
|
||||
|
@ -26,23 +36,23 @@ define internal i32 @f1() {
|
|||
ret i32 %6
|
||||
}
|
||||
|
||||
; CHECK-LABEL: define {{.*}} @f2(
|
||||
; CHECK-NEXT: store i1 true, i1* [[G_INIT]], align 1
|
||||
define internal void @f2() {
|
||||
; CHECK-LABEL: define {{[^@]+}}@f2() unnamed_addr {
|
||||
; CHECK-NEXT: store i1 true, i1* @g.init, align 1
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
define internal void @f2() {
|
||||
%1 = call noalias i8* @malloc(i64 4)
|
||||
%2 = bitcast i8* %1 to i32*
|
||||
store i32* %2, i32** @g, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK-LABEL: define {{.*}} @main(
|
||||
; CHECK-NEXT: store i1 false, i1* [[G_INIT]], align 1
|
||||
define dso_local i32 @main() {
|
||||
; CHECK-LABEL: define {{[^@]+}}@main() local_unnamed_addr {
|
||||
; CHECK-NEXT: store i1 false, i1* @g.init, align 1
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call fastcc i32 @f1()
|
||||
; CHECK-NEXT: ret i32 [[TMP1]]
|
||||
;
|
||||
define dso_local i32 @main() {
|
||||
store i32* null, i32** @g, align 8
|
||||
%1 = call i32 @f1()
|
||||
ret i32 %1
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -passes=globalopt -S < %s | FileCheck %s
|
||||
; RUN: opt -passes=globalopt -S < %s | FileCheck %s
|
||||
|
||||
@g = internal global i32* null, align 8
|
||||
|
||||
|
|
Loading…
Reference in New Issue