Imported Upstream version 5.18.0.167

Former-commit-id: 289509151e0fee68a1b591a20c9f109c3c789d3a
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-20 08:25:10 +00:00
parent e19d552987
commit b084638f15
28489 changed files with 184 additions and 3866856 deletions

View File

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

View File

@ -1,7 +0,0 @@
; RUN: opt -S -constmerge < %s | FileCheck %s
; CHECK: @foo = constant i32 6
; CHECK: @bar = constant i32 6
@foo = constant i32 6 ; <i32*> [#uses=0]
@bar = constant i32 6 ; <i32*> [#uses=0]

View File

@ -1,18 +0,0 @@
; RUN: opt -constmerge -S < %s | FileCheck %s
; PR8978
declare i32 @zed(%struct.foobar*, %struct.foobar*)
%struct.foobar = type { i32 }
; CHECK: bar.d
@bar.d = unnamed_addr constant %struct.foobar zeroinitializer, align 4
; CHECK-NOT: foo.d
@foo.d = internal constant %struct.foobar zeroinitializer, align 4
define i32 @main() nounwind ssp {
entry:
; CHECK: bar.d
%call2 = tail call i32 @zed(%struct.foobar* @foo.d, %struct.foobar* @bar.d)
nounwind
ret i32 0
}

View File

@ -1,28 +0,0 @@
; RUN: opt -constmerge -S < %s | FileCheck %s
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-n8:16:32:64-S128"
; Test that with a TD we do merge and mark the alignment as 4
@T1A = internal unnamed_addr constant i32 1
@T1B = internal unnamed_addr constant i32 1, align 2
; CHECK: @T1B = internal unnamed_addr constant i32 1, align 4
define void @test1(i32** %P1, i32** %P2) {
store i32* @T1A, i32** %P1
store i32* @T1B, i32** %P2
ret void
}
; Test that even with a TD we set the alignment to the maximum if both constants
; have explicit alignments.
@T2A = internal unnamed_addr constant i32 2, align 1
@T2B = internal unnamed_addr constant i32 2, align 2
; CHECK: @T2B = internal unnamed_addr constant i32 2, align 2
define void @test2(i32** %P1, i32** %P2) {
store i32* @T2A, i32** %P1
store i32* @T2B, i32** %P2
ret void
}

View File

@ -1,82 +0,0 @@
; RUN: opt < %s -constmerge -S | FileCheck %s
; Don't merge constants with specified sections.
@T1G1 = internal constant i32 1, section "foo"
@T1G2 = internal constant i32 1, section "bar"
@T1G3 = internal constant i32 1, section "bar"
; CHECK: @T1G1
; CHECK: @T1G2
; CHECK: @T1G3
define void @test1(i32** %P1, i32** %P2, i32** %P3) {
store i32* @T1G1, i32** %P1
store i32* @T1G2, i32** %P2
store i32* @T1G3, i32** %P3
ret void
}
@T2a = internal constant i32 224
@T2b = internal addrspace(30) constant i32 224
; CHECK: @T2a
; CHECK: @T2b
define void @test2(i32** %P1, i32 addrspace(30)** %P2) {
store i32* @T2a, i32** %P1
store i32 addrspace(30)* @T2b, i32 addrspace(30)** %P2
ret void
}
; PR8144 - Don't merge globals marked attribute(used)
; CHECK: @T3A =
; CHECK: @T3B =
@T3A = internal constant i32 0
@T3B = internal constant i32 0
@llvm.used = appending global [2 x i32*] [i32* @T3A, i32* @T3B], section
"llvm.metadata"
define void @test3() {
call void asm sideeffect "T3A, T3B",""() ; invisible use of T3A and T3B
ret void
}
; Don't merge constants with !type annotations.
@T4A1 = internal constant i32 2, !type !0
@T4A2 = internal unnamed_addr constant i32 2, !type !1
@T4B1 = internal constant i32 3, !type !0
@T4B2 = internal unnamed_addr constant i32 3, !type !0
@T4C1 = internal constant i32 4, !type !0
@T4C2 = unnamed_addr constant i32 4
@T4D1 = unnamed_addr constant i32 5, !type !0
@T4D2 = internal constant i32 5
!0 = !{i64 0, !"typeinfo name for A"}
!1 = !{i64 0, !"typeinfo name for B"}
; CHECK: @T4A1
; CHECK: @T4A2
; CHECK: @T4B1
; CHECK: @T4B2
; CHECK: @T4C1
; CHECK: @T4C2
; CHECK: @T4D1
; CHECK: @T4D2
define void @test4(i32** %P1, i32** %P2, i32** %P3, i32** %P4, i32** %P5, i32** %P6, i32** %P7, i32** %P8) {
store i32* @T4A1, i32** %P1
store i32* @T4A2, i32** %P2
store i32* @T4B1, i32** %P3
store i32* @T4B2, i32** %P4
store i32* @T4C1, i32** %P5
store i32* @T4C2, i32** %P6
store i32* @T4D1, i32** %P7
store i32* @T4D2, i32** %P8
ret void
}

View File

@ -1,41 +0,0 @@
; RUN: opt -S < %s -passes=constmerge | FileCheck %s
; Test that in one run var3 is merged into var2 and var1 into var4.
; Test that we merge @var5 and @var6 into one with the higher alignment
declare void @zed(%struct.foobar*, %struct.foobar*)
%struct.foobar = type { i32 }
@var1 = internal constant %struct.foobar { i32 2 }
@var2 = unnamed_addr constant %struct.foobar { i32 2 }
@var3 = internal constant %struct.foobar { i32 2 }
@var4 = unnamed_addr constant %struct.foobar { i32 2 }
; CHECK: %struct.foobar = type { i32 }
; CHECK-NOT: @
; CHECK: @var2 = constant %struct.foobar { i32 2 }
; CHECK-NEXT: @var4 = constant %struct.foobar { i32 2 }
declare void @helper([16 x i8]*)
@var5 = internal constant [16 x i8] c"foo1bar2foo3bar\00", align 16
@var6 = private unnamed_addr constant [16 x i8] c"foo1bar2foo3bar\00", align 1
@var7 = internal constant [16 x i8] c"foo1bar2foo3bar\00"
@var8 = private unnamed_addr constant [16 x i8] c"foo1bar2foo3bar\00"
; CHECK-NEXT: @var7 = internal constant [16 x i8] c"foo1bar2foo3bar\00"
; CHECK-NEXT: @var8 = private constant [16 x i8] c"foo1bar2foo3bar\00", align 16
@var4a = alias %struct.foobar, %struct.foobar* @var4
@llvm.used = appending global [1 x %struct.foobar*] [%struct.foobar* @var4a], section "llvm.metadata"
define i32 @main() {
entry:
call void @zed(%struct.foobar* @var1, %struct.foobar* @var2)
call void @zed(%struct.foobar* @var3, %struct.foobar* @var4)
call void @helper([16 x i8]* @var5)
call void @helper([16 x i8]* @var6)
call void @helper([16 x i8]* @var7)
call void @helper([16 x i8]* @var8)
ret i32 0
}

View File

@ -1,32 +0,0 @@
; RUN: opt < %s -constmerge -S | FileCheck %s
; CHECK: = constant i32 1, !dbg [[A:![0-9]+]], !dbg [[B:![0-9]+]]
@a = internal constant i32 1, !dbg !0
@b = unnamed_addr constant i32 1, !dbg !9
define void @test1(i32** %P1, i32** %P2) {
store i32* @a, i32** %P1
store i32* @b, i32** %P2
ret void
}
!llvm.dbg.cu = !{!2}
!llvm.module.flags = !{!7, !8}
; CHECK: [[A]] = !DIGlobalVariableExpression(var: [[VA:![0-9]+]], expr: !DIExpression())
; CHECK: [[VA]] = distinct !DIGlobalVariable(name: "y"
; CHECK: [[B]] = !DIGlobalVariableExpression(var: [[VB:![0-9]+]], expr: !DIExpression())
; CHECK: [[VB]] = distinct !DIGlobalVariable(name: "x"
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = distinct !DIGlobalVariable(name: "x", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 5.0.0 (trunk 297227) (llvm/trunk 297234)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
!3 = !DIFile(filename: "1.cc", directory: "/build")
!4 = !{}
!5 = !{!0}
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!7 = !{i32 2, !"Dwarf Version", i32 4}
!8 = !{i32 2, !"Debug Info Version", i32 3}
!9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression())
!10 = distinct !DIGlobalVariable(name: "y", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)

View File

@ -1,40 +0,0 @@
; RUN: opt -constmerge -S < %s | FileCheck %s
; Test which corresponding x and y are merged and that unnamed_addr
; is correctly set.
declare void @zed(%struct.foobar*, %struct.foobar*)
%struct.foobar = type { i32 }
@test1.x = internal constant %struct.foobar { i32 1 }
@test1.y = constant %struct.foobar { i32 1 }
@test2.x = internal constant %struct.foobar { i32 2 }
@test2.y = unnamed_addr constant %struct.foobar { i32 2 }
@test3.x = internal unnamed_addr constant %struct.foobar { i32 3 }
@test3.y = constant %struct.foobar { i32 3 }
@test4.x = internal unnamed_addr constant %struct.foobar { i32 4 }
@test4.y = unnamed_addr constant %struct.foobar { i32 4 }
; CHECK: %struct.foobar = type { i32 }
; CHECK-NOT: @
; CHECK: @test1.x = internal constant %struct.foobar { i32 1 }
; CHECK-NEXT: @test1.y = constant %struct.foobar { i32 1 }
; CHECK-NEXT: @test2.y = constant %struct.foobar { i32 2 }
; CHECK-NEXT: @test3.y = constant %struct.foobar { i32 3 }
; CHECK-NEXT: @test4.y = unnamed_addr constant %struct.foobar { i32 4 }
; CHECK-NOT: @
; CHECK: declare void @zed(%struct.foobar*, %struct.foobar*)
define i32 @main() {
entry:
call void @zed(%struct.foobar* @test1.x, %struct.foobar* @test1.y)
call void @zed(%struct.foobar* @test2.x, %struct.foobar* @test2.y)
call void @zed(%struct.foobar* @test3.x, %struct.foobar* @test3.y)
call void @zed(%struct.foobar* @test4.x, %struct.foobar* @test4.y)
ret i32 0
}