Imported Upstream version 5.18.0.207

Former-commit-id: 3b152f462918d427ce18620a2cbe4f8b79650449
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-11-17 08:23:10 +00:00
parent 8e12397d70
commit eb85e2fc17
28480 changed files with 72 additions and 3866936 deletions

View File

@@ -1,9 +0,0 @@
; RUN: llvm-as < %s | llvm-dis | grep "llvm.stuff = "
;; Simple NamedMDNode
!0 = !{i32 42}
!1 = !{!"foo"}
!llvm.stuff = !{!0, !1}
!samename = !{!0, !1}
declare void @samename()

View File

@@ -1,7 +0,0 @@
; RUN: llvm-as < %s -o /dev/null
; PR4654
@foo = constant i1 false
!0 = !{i1 false}
!a = !{!0}

View File

@@ -1,49 +0,0 @@
; RUN: opt -S -adce < %s | FileCheck %s
; While it is normally okay to DCE out calls to @readonly_function and
; @readnone_function, we cannot do that if they're carrying operand
; bundles since the presence of unknown operand bundles implies
; arbitrary memory effects.
declare void @readonly_function() readonly nounwind
declare void @readnone_function() readnone nounwind
define void @test0() {
; CHECK-LABEL: @test0(
entry:
call void @readonly_function() [ "tag"() ]
; CHECK: call void @readonly_function
ret void
}
define void @test1() {
; CHECK-LABEL: @test1(
entry:
call void @readnone_function() [ "tag"() ]
; CHECK: call void @readnone_function
ret void
}
define void @test2() {
; CHECK-LABEL: @test2(
entry:
; CHECK-NOT: @readonly_function(
call void @readonly_function() readonly [ "tag"() ]
ret void
}
define void @test3() {
; CHECK-LABEL: @test3(
entry:
; CHECK-NOT: @readnone_function(
call void @readnone_function() readnone [ "tag"() ]
ret void
}
define void @test4() {
; CHECK-LABEL: @test4(
entry:
; CHECK-NOT: @readonly_function()
call void @readonly_function() [ "deopt"() ]
ret void
}

View File

@@ -1,51 +0,0 @@
; RUN: opt -S -basicaa -gvn < %s | FileCheck %s
declare void @argmemonly_function(i32 *) argmemonly
define i32 @test0(i32* %P, i32* noalias %P2) {
; CHECK-LABEL: @test0(
%v1 = load i32, i32* %P
; CHECK: %v1 = load i32, i32* %P
call void @argmemonly_function(i32* %P2) [ "tag"() ]
; CHECK: call void @argmemonly_function(
%v2 = load i32, i32* %P
; CHECK: %v2 = load i32, i32* %P
%diff = sub i32 %v1, %v2
; CHECK: %diff = sub i32 %v1, %v2
ret i32 %diff
; CHECK: ret i32 %diff
}
define i32 @test1(i32* %P, i32* noalias %P2) {
; CHECK-LABEL: @test1(
%v1 = load i32, i32* %P
call void @argmemonly_function(i32* %P2) argmemonly [ "tag"() ]
; CHECK: call void @argmemonly_function(
%v2 = load i32, i32* %P
%diff = sub i32 %v1, %v2
ret i32 %diff
; CHECK: ret i32 0
}
define i32 @test2(i32* %P, i32* noalias %P2) {
; Note: in this test we //can// GVN %v1 and %v2 into one value in theory. Calls
; with deopt operand bundles are not argmemonly because they *read* the entire
; heap, but they don't write to any location in the heap if the callee does not
; deoptimize the caller. This fact, combined with the fact that
; @argmemonly_function is, well, an argmemonly function, can be used to conclude
; that %P is not written to at the callsite. However LLVM currently cannot
; describe the "does not write to non-args, and reads the entire heap" effect on
; a callsite.
; CHECK-LABEL: @test2(
%v1 = load i32, i32* %P
; CHECK: %v1 = load i32, i32* %P
call void @argmemonly_function(i32* %P2) [ "deopt"() ]
; CHECK: call void @argmemonly_function(
%v2 = load i32, i32* %P
; CHECK: %v2 = load i32, i32* %P
%diff = sub i32 %v1, %v2
; CHECK: %diff = sub i32 %v1, %v2
ret i32 %diff
; CHECK: ret i32 %diff
}

View File

@@ -1,62 +0,0 @@
; RUN: opt -S -dse < %s | FileCheck %s
declare void @f()
declare noalias i8* @malloc(i32) nounwind
define void @test_0() {
; CHECK-LABEL: @test_0(
%m = call i8* @malloc(i32 24)
tail call void @f() [ "unknown"(i8* %m) ]
; CHECK: store i8 -19, i8* %m
store i8 -19, i8* %m
ret void
}
define i8* @test_1() {
; CHECK-LABEL: @test_1(
%m = call i8* @malloc(i32 24)
tail call void @f() [ "unknown"(i8* %m) ]
store i8 -19, i8* %m
tail call void @f()
store i8 101, i8* %m
; CHECK: tail call void @f() [ "unknown"(i8* %m) ]
; CHECK: store i8 -19, i8* %m
; CHECK: tail call void @f()
; CHECK: store i8 101, i8* %m
ret i8* %m
}
define void @test_2() {
; Since the deopt operand bundle does not escape %m (see caveat below), it is
; legal to elide the final store that location.
; CHECK-LABEL: @test_2(
%m = call i8* @malloc(i32 24)
tail call void @f() [ "deopt"(i8* %m) ]
store i8 -19, i8* %m
ret void
; CHECK: tail call void @f() [ "deopt"(i8* %m) ]
; CHECK-NEXT: ret void
}
define i8* @test_3() {
; Since the deopt operand bundle does not escape %m (see caveat below), @f
; cannot observe the stores to %m
; CHECK-LABEL: @test_3(
%m = call i8* @malloc(i32 24)
tail call void @f() [ "deopt"(i8* %m) ]
store i8 -19, i8* %m
tail call void @f()
store i8 101, i8* %m
ret i8* %m
}
; Caveat: technically, %m can only escape if the calling function is deoptimized
; at the call site (i.e. the call returns to the "deopt" continuation). Since
; the calling function body will be invalidated in that case, the calling
; function can be optimized under the assumption that %m does not escape.

View File

@@ -1,89 +0,0 @@
; RUN: opt -S -early-cse < %s | FileCheck %s
; While it is normally okay to do memory optimizations over calls to
; @readonly_function and @readnone_function, we cannot do that if
; they're carrying unknown operand bundles since the presence of
; unknown operand bundles implies arbitrary memory effects.
declare void @readonly_function() readonly nounwind
declare void @readnone_function() readnone nounwind
define i32 @test0(i32* %x) {
; CHECK-LABEL: @test0(
entry:
store i32 100, i32* %x
; CHECK: store i32 100, i32* %x
call void @readonly_function() [ "tag"() ]
; CHECK: call void @readonly_function()
%v = load i32, i32* %x
; CHECK: %v = load i32, i32* %x
; CHECK: ret i32 %v
ret i32 %v
}
define i32 @test1(i32* %x) {
; CHECK: @test1(
entry:
store i32 100, i32* %x
; CHECK: store i32 100, i32* %x
call void @readonly_function() readonly [ "tag"() ]
; CHECK-NOT: call void @readonly_function
%v = load i32, i32* %x
ret i32 %v
; CHECK: ret i32 100
}
define i32 @test3(i32* %x) {
; CHECK-LABEL: @test3(
entry:
store i32 100, i32* %x
; CHECK: store i32 100, i32* %x
call void @readonly_function()
; CHECK-NOT: call void @readonly_function
%v = load i32, i32* %x
ret i32 %v
; CHECK: ret i32 100
}
define void @test4(i32* %x) {
; CHECK-LABEL: @test4(
entry:
store i32 100, i32* %x
; CHECK: store i32 100, i32* %x
call void @readnone_function() [ "tag"() ]
; CHECK: call void @readnone_function
store i32 200, i32* %x
; CHECK: store i32 200, i32* %x
ret void
}
define void @test5(i32* %x) {
; CHECK-LABEL: @test5(
entry:
store i32 100, i32* %x
; CHECK-NOT: store i32 100, i32* %x
; CHECK-NOT: call void @readnone_function
call void @readnone_function() readnone [ "tag"() ]
store i32 200, i32* %x
; CHECK: store i32 200, i32* %x
ret void
}
define void @test6(i32* %x) {
; The "deopt" operand bundle does not make the call to
; @readonly_function read-write; and so the nounwind readonly call can
; be deleted.
; CHECK-LABEL: @test6(
entry:
; CHECK-NEXT: entry:
; CHECK-NEXT: store i32 200, i32* %x
; CHECK-NEXT: ret void
store i32 100, i32* %x
call void @readonly_function() [ "deopt"() ]
store i32 200, i32* %x
ret void
}

View File

@@ -1,33 +0,0 @@
; RUN: opt -S -functionattrs < %s | FileCheck %s
declare void @f_readonly() readonly
declare void @f_readnone() readnone
define void @test_0(i32* %x) {
; FunctionAttrs must not infer readonly / readnone for %x
; CHECK-LABEL: define void @test_0(i32* %x) {
entry:
; CHECK: call void @f_readonly() [ "foo"(i32* %x) ]
call void @f_readonly() [ "foo"(i32* %x) ]
ret void
}
define void @test_1(i32* %x) {
; FunctionAttrs must not infer readonly / readnone for %x
; CHECK-LABEL: define void @test_1(i32* %x) {
entry:
; CHECK: call void @f_readnone() [ "foo"(i32* %x) ]
call void @f_readnone() [ "foo"(i32* %x) ]
ret void
}
define void @test_2(i32* %x) {
; The "deopt" operand bundle does not capture or write to %x.
; CHECK-LABEL: define void @test_2(i32* nocapture readonly %x)
entry:
call void @f_readonly() [ "deopt"(i32* %x) ]
ret void
}

View File

@@ -1,17 +0,0 @@
; RUN: opt -S -inline < %s | FileCheck %s
; Check that the inliner does not inline through arbitrary unknown
; operand bundles.
define i32 @callee() {
entry:
ret i32 2
}
define i32 @caller() {
; CHECK: @caller(
entry:
; CHECK: call i32 @callee() [ "unknown"() ]
%x = call i32 @callee() [ "unknown"() ]
ret i32 %x
}

View File

@@ -1,64 +0,0 @@
; RUN: opt -S -mergefunc < %s | FileCheck %s
; Minor note: functions need to be at least three instructions long
; to be considered by -mergefunc.
declare i32 @foo(...)
define i32 @f() {
; CHECK-LABEL: @f(
entry:
%v0 = call i32 (...) @foo(i32 10) [ "foo"(i32 20) ]
%v1 = call i32 (...) @foo(i32 10) [ "foo"(i32 20) ]
%v2 = call i32 (...) @foo(i32 10) [ "foo"(i32 20) ]
; CHECK: %v0 = call i32 (...) @foo(i32 10) [ "foo"(i32 20) ]
; CHECK: %v1 = call i32 (...) @foo(i32 10) [ "foo"(i32 20) ]
; CHECK: %v2 = call i32 (...) @foo(i32 10) [ "foo"(i32 20) ]
ret i32 %v2
}
define i32 @g() {
; CHECK-LABEL: @g(
entry:
%v0 = call i32 (...) @foo() [ "foo"(i32 10, i32 20) ]
%v1 = call i32 (...) @foo() [ "foo"(i32 10, i32 20) ]
%v2 = call i32 (...) @foo() [ "foo"(i32 10, i32 20) ]
; CHECK: %v0 = call i32 (...) @foo() [ "foo"(i32 10, i32 20) ]
; CHECK: %v1 = call i32 (...) @foo() [ "foo"(i32 10, i32 20) ]
; CHECK: %v2 = call i32 (...) @foo() [ "foo"(i32 10, i32 20) ]
ret i32 %v2
}
define i32 @f.invoke() personality i8 3 {
; CHECK-LABEL: @f.invoke(
entry:
; CHECK: %v0 = invoke i32 (...) @foo(i32 10) [ "foo"(i32 20) ]
%v0 = invoke i32 (...) @foo(i32 10) [ "foo"(i32 20) ]
to label %normal unwind label %exception
normal:
ret i32 %v0
exception:
%cleanup = landingpad i8 cleanup
ret i32 0
}
define i32 @g.invoke() personality i8 3 {
; CHECK-LABEL: @g.invoke(
entry:
; CHECK: %v0 = invoke i32 (...) @foo() [ "foo"(i32 10, i32 20) ]
%v0 = invoke i32 (...) @foo() [ "foo"(i32 10, i32 20) ]
to label %normal unwind label %exception
normal:
ret i32 %v0
exception:
%cleanup = landingpad i8 cleanup
ret i32 0
}

View File

@@ -1,27 +0,0 @@
; RUN: opt -S -globals-aa -functionattrs < %s | FileCheck %s
; RUN: opt -S -O3 < %s | FileCheck %s
; Apart from checking for the direct cause of the bug, we also check
; if any problematic aliasing rules have accidentally snuck into -O3.
;
; Since the "abc" operand bundle is not a special operand bundle that
; LLVM knows about, all of the stores and loads in @test below have to
; stay.
declare void @foo() readnone
; CHECK-LABEL: define i8* @test(i8* %p)
; CHECK: %a = alloca i8*, align 8
; CHECK: store i8* %p, i8** %a, align 8
; CHECK: call void @foo() [ "abc"(i8** %a) ]
; CHECK: %reload = load i8*, i8** %a, align 8
; CHECK: ret i8* %reload
; CHECK: }
define i8* @test(i8* %p) {
%a = alloca i8*, align 8
store i8* %p, i8** %a, align 8
call void @foo() ["abc" (i8** %a)]
%reload = load i8*, i8** %a, align 8
ret i8* %reload
}

View File

@@ -1,21 +0,0 @@
; RUN: opt -S -early-cse < %s | FileCheck %s
; This test isn't directly related to EarlyCSE or varargs. It is just
; using these as a vehicle for testing the correctness of
; haveSameSpecialState around operand bundles.
declare i32 @foo(...)
define i32 @f() {
; CHECK-LABEL: @f(
entry:
; CHECK: %v0 = call i32 (...) @foo(
; CHECK: %v1 = call i32 (...) @foo(
; CHECK: %v = add i32 %v0, %v1
; CHECK: ret i32 %v
%v0 = call i32 (...) @foo(i32 10) readonly [ "foo"(i32 20) ]
%v1 = call i32 (...) @foo() readonly [ "foo"(i32 10, i32 20) ]
%v = add i32 %v0, %v1
ret i32 %v
}

View File

@@ -1,6 +0,0 @@
This directory contains test cases for individual source features of LLVM.
It is designed to make sure that the major components of LLVM support all of the
features of LLVM, for very small examples. Entire programs should not go here.
Regression tests for individual bug fixes should go into the test/Regression dir.

View File

@@ -1,28 +0,0 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
@v1 = global i32 0
; CHECK: @v1 = global i32 0
@v2 = global [1 x i32] zeroinitializer
; CHECK: @v2 = global [1 x i32] zeroinitializer
@v3 = global [2 x i16] zeroinitializer
; CHECK: @v3 = global [2 x i16] zeroinitializer
@a1 = alias i16, bitcast (i32* @v1 to i16*)
; CHECK: @a1 = alias i16, bitcast (i32* @v1 to i16*)
@a2 = alias i32, bitcast([1 x i32]* @v2 to i32*)
; CHECK: @a2 = alias i32, getelementptr inbounds ([1 x i32], [1 x i32]* @v2, i32 0, i32 0)
@a3 = alias i32, addrspacecast (i32* @v1 to i32 addrspace(2)*)
; CHECK: @a3 = alias i32, addrspacecast (i32* @v1 to i32 addrspace(2)*)
@a4 = alias i16, bitcast (i32* @v1 to i16*)
; CHECK: @a4 = alias i16, bitcast (i32* @v1 to i16*)
@a5 = thread_local(localdynamic) alias i32, i32* @v1
; CHECK: @a5 = thread_local(localdynamic) alias i32, i32* @v1
@a6 = alias i16, getelementptr ([2 x i16], [2 x i16]* @v3, i32 1, i32 1)
; CHECK: @a6 = alias i16, getelementptr ([2 x i16], [2 x i16]* @v3, i32 1, i32 1)

View File

@@ -1,43 +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
@llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @foo1 to i8*)], section "llvm.metadata"
@bar = global i32 0
@foo1 = alias i32, i32* @bar
@foo2 = alias i32, i32* @bar
@foo3 = alias i32, i32* @foo2
@foo4 = unnamed_addr alias i32, i32* @foo2
; Make sure the verifier does not complain about references to a global
; declaration from an initializer.
@decl = external global i32
@ptr = global i32* @decl
@ptr_a = alias i32*, i32** @ptr
%FunTy = type i32()
define i32 @foo_f() {
ret i32 0
}
@bar_f = weak_odr alias %FunTy, %FunTy* @foo_f
@bar_ff = alias i32(), i32()* @bar_f
@bar_i = internal alias i32, i32* @bar
@A = alias i64, bitcast (i32* @bar to i64*)
define i32 @test() {
entry:
%tmp = load i32, i32* @foo1
%tmp1 = load i32, i32* @foo2
%tmp0 = load i32, i32* @bar_i
%tmp2 = call i32 @foo_f()
%tmp3 = add i32 %tmp, %tmp2
%tmp4 = call %FunTy @bar_f()
%tmp5 = add i32 %tmp3, %tmp4
%tmp6 = add i32 %tmp1, %tmp5
%tmp7 = add i32 %tmp6, %tmp0
ret i32 %tmp7
}

View File

@@ -1,16 +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
@X = global i32 4, align 16 ; <i32*> [#uses=0]
define i32* @test() align 32 {
%X = alloca i32, align 4 ; <i32*> [#uses=1]
%Y = alloca i32, i32 42, align 16 ; <i32*> [#uses=0]
%Z = alloca i32 ; <i32*> [#uses=0]
ret i32* %X
}
define void @test3() alignstack(16) {
ret void
}

View File

@@ -1,15 +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
@.str = private unnamed_addr constant [14 x i8] c"hello world!\0A\00", align 1
define void @foo() #0 {
entry:
%call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i32 0, i32 0))
ret void
}
declare i32 @printf(i8*, ...)
attributes #0 = { nounwind ssp uwtable }

View File

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

View File

@@ -1,69 +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
define fastcc void @foo() {
ret void
}
define coldcc void @bar() {
call fastcc void @foo( )
ret void
}
define void @structret({ i8 }* sret %P) {
call void @structret( { i8 }* sret %P )
ret void
}
define void @foo2() {
ret void
}
define coldcc void @bar2() {
call fastcc void @foo( )
ret void
}
define cc42 void @bar3() personality i32 (...)* @__gxx_personality_v0 {
invoke fastcc void @foo( )
to label %Ok unwind label %U
Ok:
ret void
U:
%exn = landingpad {i8*, i32}
cleanup
resume { i8*, i32 } %exn
}
define void @bar4() personality i32 (...)* @__gxx_personality_v0 {
call cc42 void @bar( )
invoke cc42 void @bar3( )
to label %Ok unwind label %U
Ok:
ret void
U:
%exn = landingpad {i8*, i32}
cleanup
resume { i8*, i32 } %exn
}
declare ghccc void @ghc_callee()
define void @ghc_caller() {
call ghccc void @ghc_callee()
ret void
}
declare hhvm_ccc void @hhvm_c_callee()
define hhvmcc void @hhvm_caller() {
call hhvm_ccc void @hhvm_c_callee()
ret void
}
declare i32 @__gxx_personality_v0(...)

View File

@@ -1,34 +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
%FunTy = type i32 (i32)
define void @invoke(%FunTy* %x) {
%foo = call i32 %x( i32 123 ) ; <i32> [#uses=0]
%foo2 = tail call i32 %x( i32 123 ) ; <i32> [#uses=0]
ret void
}
define i32 @main(i32 %argc) personality i32 (...)* @__gxx_personality_v0 {
%retval = call i32 @test( i32 %argc ) ; <i32> [#uses=2]
%two = add i32 %retval, %retval ; <i32> [#uses=1]
%retval2 = invoke i32 @test( i32 %argc )
to label %Next unwind label %Error ; <i32> [#uses=1]
Next:
%two2 = add i32 %two, %retval2 ; <i32> [#uses=1]
call void @invoke( %FunTy* @test )
ret i32 %two2
Error:
%exn = landingpad {i8*, i32}
cleanup
ret i32 -1
}
define i32 @test(i32 %i0) {
ret i32 %i0
}
declare i32 @__gxx_personality_v0(...)

View File

@@ -1,12 +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
define i16 @FunFunc(i64 %x, i8 %z) {
bb0:
%cast110 = sext i8 %z to i16 ; <i16> [#uses=1]
%cast10 = trunc i64 %x to i16 ; <i16> [#uses=1]
%reg109 = add i16 %cast110, %cast10 ; <i16> [#uses=1]
ret i16 %reg109
}

Some files were not shown because too many files have changed in this diff Show More