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,30 +0,0 @@
; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
; RUN: llvm-as < %s | lli --force-interpreter=true | FileCheck %s
; CHECK: -255
@ARRAY = global [ 20 x i17 ] zeroinitializer
@FORMAT = constant [ 4 x i8 ] c"%d\0A\00"
declare i32 @printf(i8* %format, ...)
define void @multiply(i32 %index, i32 %X, i32 %Y) {
%Z = mul i32 %X, %Y
%P = getelementptr [20 x i17], [20 x i17]* @ARRAY, i32 0, i32 %index
%Result = trunc i32 %Z to i17
store i17 %Result, i17* %P
ret void
}
define i32 @main(i32 %argc, i8** %argv) {
%i = bitcast i32 0 to i32
call void @multiply(i32 %i, i32 -1, i32 255)
%P = getelementptr [20 x i17], [20 x i17]* @ARRAY, i32 0, i32 0
%X = load i17, i17* %P
%result = sext i17 %X to i32
%fmt = getelementptr [4 x i8], [4 x i8]* @FORMAT, i32 0, i32 0
call i32 (i8*,...) @printf(i8* %fmt, i32 %result)
ret i32 0
}

View File

@@ -1,21 +0,0 @@
; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
@foo1 = external global <4 x float>
@foo2 = external global <2 x i10>
define void @main()
{
store <4 x float> <float 1.0, float 2.0, float 3.0, float 4.0>, <4 x float>* @foo1
store <2 x i10> <i10 4, i10 4>, <2 x i10>* @foo2
%l1 = load <4 x float>, <4 x float>* @foo1
%l2 = load <2 x i10>, <2 x i10>* @foo2
%r1 = extractelement <2 x i10> %l2, i32 1
%r2 = extractelement <2 x i10> %l2, i32 0
%t = mul i10 %r1, %r2
%r3 = insertelement <2 x i10> %l2, i10 %t, i32 0
store <2 x i10> %r3, <2 x i10>* @foo2
ret void
}

View File

@@ -1,31 +0,0 @@
; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
; Test "stripped" format where nothing is symbolic... this is how the bytecode
; format looks anyways (except for negative vs positive offsets)...
;
define void @void(i39, i39) {
add i39 0, 0 ; <i39>:3 [#uses=2]
sub i39 0, 4 ; <i39>:4 [#uses=2]
br label %5
; <label>:5 ; preds = %5, %2
add i39 %0, %1 ; <i39>:6 [#uses=2]
sub i39 %6, %4 ; <i39>:7 [#uses=1]
icmp sle i39 %7, %3 ; <i1>:8 [#uses=1]
br i1 %8, label %9, label %5
; <label>:9 ; preds = %5
add i39 %0, %1 ; <i39>:10 [#uses=0]
sub i39 %6, %4 ; <i39>:11 [#uses=1]
icmp sle i39 %11, %3 ; <i1>:12 [#uses=0]
ret void
}
; This function always returns zero
define i39 @zarro() {
Startup:
ret i39 0
}

View File

@@ -1,84 +0,0 @@
; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
; This testcase is for testing expressions constructed from
; constant values, including constant pointers to globals.
;
;;-------------------------------
;; Test constant cast expressions
;;-------------------------------
@0 = global i63 u0x00001 ; hexadecimal unsigned integer constants
@1 = global i63 s0x012312 ; hexadecimal signed integer constants
@t2 = global i33* @t1 ;; Forward reference without cast
@t3 = global i33* bitcast (i33* @t1 to i33*) ;; Forward reference with cast
@t1 = global i33 4 ;; i32* @0
@t4 = global i33** bitcast (i33** @t3 to i33**) ;; Cast of a previous cast
@t5 = global i33** @t3 ;; Reference to a previous cast
@t6 = global i33*** @t4
@t7 = global float* inttoptr (i32 12345678 to float*) ;; Cast ordinary value to ptr
@t9 = global i33 fptosi (float sitofp (i33 8 to float) to i33) ;; Nested cast expression
@2 = global i32* bitcast (float* @4 to i32*) ;; Forward numeric reference
@3 = global float* @4 ;; Duplicate forward numeric reference
@4 = global float 0.0
;;---------------------------------------------------
;; Test constant getelementpr expressions for arrays
;;---------------------------------------------------
@array = constant [2 x i33] [ i33 12, i33 52 ]
@arrayPtr = global i33* getelementptr ([2 x i33], [2 x i33]* @array, i64 0, i64 0) ;; i33* &@array[0][0]
@arrayPtr5 = global i33** getelementptr (i33*, i33** @arrayPtr, i64 5) ;; i33* &@arrayPtr[5]
@somestr = constant [11x i8] c"hello world"
@char5 = global i8* getelementptr([11x i8], [11x i8]* @somestr, i64 0, i64 5)
;; cast of getelementptr
@char8a = global i33* bitcast (i8* getelementptr([11x i8], [11x i8]* @somestr, i64 0, i64 8) to i33*)
;; getelementptr containing casts
@char8b = global i8* getelementptr([11x i8], [11x i8]* @somestr, i64 sext (i8 0 to i64), i64 sext (i8 8 to i64))
;;-------------------------------------------------------
;; TODO: Test constant getelementpr expressions for structures
;;-------------------------------------------------------
%SType = type { i33 , {float, {i8} }, i64 } ;; struct containing struct
%SAType = type { i33 , {[2x float], i64} } ;; struct containing array
@S1 = global %SType* null ;; Global initialized to NULL
@S2c = constant %SType { i33 1, {float,{i8}} {float 2.0, {i8} {i8 3}}, i64 4}
@S3c = constant %SAType { i33 1, {[2x float], i64} {[2x float] [float 2.0, float 3.0], i64 4} }
@S1ptr = global %SType** @S1 ;; Ref. to global S1
@S2 = global %SType* @S2c ;; Ref. to constant S2
@S3 = global %SAType* @S3c ;; Ref. to constant S3
;; Pointer to float (**@S1).1.0
@S1fld1a = global float* getelementptr (%SType, %SType* @S2c, i64 0, i32 1, i32 0)
;; Another ptr to the same!
@S1fld1b = global float* getelementptr (%SType, %SType* @S2c, i64 0, i32 1, i32 0)
@S1fld1bptr = global float** @S1fld1b ;; Ref. to previous pointer
;; Pointer to i8 (**@S2).1.1.0
@S2fld3 = global i8* getelementptr (%SType, %SType* @S2c, i64 0, i32 1, i32 1, i32 0)
;; Pointer to float (**@S2).1.0[0]
;@S3fld3 = global float* getelementptr (%SAType*, %SAType** @S3, i64 0, i64 0, i32 1, i32 0, i64 0)
;;---------------------------------------------------------
;; TODO: Test constant expressions for unary and binary operators
;;---------------------------------------------------------
;;---------------------------------------------------

View File

@@ -1,32 +0,0 @@
; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
; This testcase is primarily used for testing that global values can be used as
; constant pointer initializers. This is tricky because they can be forward
; declared and involves an icky bytecode encoding. There is no meaningful
; optimization that can be performed on this file, it is just here to test
; assembly and disassembly.
;
@t3 = global i40 * @t1 ;; Forward reference
@t1 = global i40 4
@t4 = global i40 ** @t3 ;; reference to reference
@t2 = global i40 * @t1
@0 = global float * @2 ;; Forward numeric reference
@1 = global float * @2 ;; Duplicate forward numeric reference
@2 = global float 0.0
@3 = global float * @2 ;; Numeric reference
@fptr = global void() * @f ;; Forward ref method defn
declare void @"f"() ;; External method
@sptr1 = global [11x i8]* @somestr ;; Forward ref to a constant
@somestr = constant [11x i8] c"hello world"
@sptr2 = global [11x i8]* @somestr

View File

@@ -1,34 +0,0 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; CHECK-NOT: bitcast
define i60 @test1() {
ret i60 fptoui(float 0x400D9999A0000000 to i60)
}
define float @test2() {
ret float uitofp(i60 17 to float)
}
define i64 @test3() {
ret i64 bitcast (double 0x400921FB4D12D84A to i64)
}
define double @test4() {
ret double bitcast (i64 42 to double)
}
define i30 @test5() {
ret i30 fptoui(float 0x400D9999A0000000 to i30)
}
define float @test6() {
ret float uitofp(i30 17 to float)
}
define i64 @test7() {
ret i64 bitcast (double 0x400921FB4D12D84A to i64)
}
define double @test8() {
ret double bitcast (i64 42 to double)
}

View File

@@ -1,26 +0,0 @@
; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
define i39 @test_extractelement(<4 x i39> %V) {
%R = extractelement <4 x i39> %V, i32 1
ret i39 %R
}
define <4 x i39> @test_insertelement(<4 x i39> %V) {
%R = insertelement <4 x i39> %V, i39 0, i32 0
ret <4 x i39> %R
}
define <4 x i39> @test_shufflevector_u(<4 x i39> %V) {
%R = shufflevector <4 x i39> %V, <4 x i39> %V,
<4 x i32> < i32 1, i32 undef, i32 7, i32 2>
ret <4 x i39> %R
}
define <4 x float> @test_shufflevector_f(<4 x float> %V) {
%R = shufflevector <4 x float> %V, <4 x float> undef,
<4 x i32> < i32 1, i32 undef, i32 7, i32 2>
ret <4 x float> %R
}

View File

@@ -1,28 +0,0 @@
; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
define void @"NewCasts" (i17 %x) {
%a = zext i17 %x to i32
%b = sext i17 %x to i32
%c = trunc i17 %x to i8
%d = uitofp i17 %x to float
%e = sitofp i17 %x to double
%f = fptoui float %d to i17
%g = fptosi double %e to i17
%i = fpext float %d to double
%j = fptrunc double %i to float
%k = bitcast i32 %a to float
%l = inttoptr i17 %x to i32*
%m = ptrtoint i32* %l to i64
ret void
}
define i17 @"ZExtConst" () {
ret i17 trunc ( i32 zext ( i17 42 to i32) to i17 )
}
define i17 @"SExtConst" () {
ret i17 trunc (i32 sext (i17 42 to i32) to i17 )
}

View File

@@ -1,16 +0,0 @@
; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
@foo1 = external global <4 x float>
@foo2 = external global <2 x i10>
define void @main()
{
store <4 x float> <float 1.0, float 2.0, float 3.0, float 4.0>, <4 x float>* @foo1
store <2 x i10> <i10 4, i10 4>, <2 x i10>* @foo2
%l1 = load <4 x float>, <4 x float>* @foo1
%l2 = load <2 x i10>, <2 x i10>* @foo2
ret void
}

View File

@@ -1,33 +0,0 @@
; RUN: llvm-as < %s | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
; RUN: FileCheck %s --input-file=%t2.ll
; CHECK-NOT: cast
; CHECK: }>
%struct.anon = type <{ i8, i35, i35, i35 }>
@foos = external global %struct.anon
@bara = external global [2 x <{ i35, i8 }>]
;initializers should work for packed and non-packed the same way
@E1 = global <{i8, i35, i35}> <{i8 1, i35 2, i35 3}>
@E2 = global {i8, i35, i35} {i8 4, i35 5, i35 6}
define i35 @main()
{
%tmp = load i35, i35* getelementptr (%struct.anon, %struct.anon* @foos, i32 0, i32 1) ; <i35> [#uses=1]
%tmp3 = load i35, i35* getelementptr (%struct.anon, %struct.anon* @foos, i32 0, i32 2) ; <i35> [#uses=1]
%tmp6 = load i35, i35* getelementptr (%struct.anon, %struct.anon* @foos, i32 0, i32 3) ; <i35> [#uses=1]
%tmp4 = add i35 %tmp3, %tmp ; <i35> [#uses=1]
%tmp7 = add i35 %tmp4, %tmp6 ; <i35> [#uses=1]
ret i35 %tmp7
}
define i35 @bar() {
entry:
%tmp = load i35, i35* getelementptr([2 x <{ i35, i8 }>], [2 x <{ i35, i8 }>]* @bara, i32 0, i32 0, i32 0 ) ; <i35> [#uses=1]
%tmp4 = load i35, i35* getelementptr ([2 x <{ i35, i8 }>], [2 x <{ i35, i8 }>]* @bara, i32 0, i32 1, i32 0) ; <i35> [#uses=1]
%tmp5 = add i35 %tmp4, %tmp ; <i35> [#uses=1]
ret i35 %tmp5
}

View File

@@ -1,7 +0,0 @@
; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
target datalayout = "e-p:32:32"
target triple = "proc-vend-sys"

View File

@@ -1,18 +0,0 @@
; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
@X = global i31 undef
declare i32 @"atoi"(i8 *)
define i63 @test() {
ret i63 undef
}
define i31 @test2() {
%X = add i31 undef, 1
ret i31 %X
}

View File

@@ -1,16 +0,0 @@
; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
declare void @bar()
define i9 @foo() { ;; Calling this function has undefined behavior
unreachable
}
define double @xyz() {
call void @bar()
unreachable ;; Bar must not return.
}