Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@ -0,0 +1,25 @@
; RUN: opt -lint < %s
target datalayout = "p32:32:32-p1:16:16:16-n16:32"
declare void @foo(i64) nounwind
define i64 @test1(i32 addrspace(1)* %x) nounwind {
%y = ptrtoint i32 addrspace(1)* %x to i64
ret i64 %y
}
define <4 x i64> @test1_vector(<4 x i32 addrspace(1)*> %x) nounwind {
%y = ptrtoint <4 x i32 addrspace(1)*> %x to <4 x i64>
ret <4 x i64> %y
}
define i32 addrspace(1)* @test2(i64 %x) nounwind {
%y = inttoptr i64 %x to i32 addrspace(1)*
ret i32 addrspace(1)* %y
}
define <4 x i32 addrspace(1)*> @test2_vector(<4 x i64> %x) nounwind {
%y = inttoptr <4 x i64> %x to <4 x i32 addrspace(1)*>
ret <4 x i32 addrspace(1)*> %y
}

View File

@ -0,0 +1,78 @@
; RUN: opt -lint -disable-output %s 2>&1 | FileCheck %s
define <2 x i32> @use_vector_sdiv(<2 x i32> %a) nounwind {
%b = sdiv <2 x i32> %a, <i32 5, i32 8>
ret <2 x i32> %b
}
define <2 x i32> @use_vector_srem(<2 x i32> %a) nounwind {
%b = srem <2 x i32> %a, <i32 5, i32 8>
ret <2 x i32> %b
}
define <2 x i32> @use_vector_udiv(<2 x i32> %a) nounwind {
%b = udiv <2 x i32> %a, <i32 5, i32 8>
ret <2 x i32> %b
}
define <2 x i32> @use_vector_urem(<2 x i32> %a) nounwind {
%b = urem <2 x i32> %a, <i32 5, i32 8>
ret <2 x i32> %b
}
define i32 @use_sdiv_by_zero(i32 %a) nounwind {
; CHECK: Undefined behavior: Division by zero
; CHECK-NEXT: %b = sdiv i32 %a, 0
%b = sdiv i32 %a, 0
ret i32 %b
}
define i32 @use_sdiv_by_zeroinitializer(i32 %a) nounwind {
; CHECK: Undefined behavior: Division by zero
; CHECK-NEXT: %b = sdiv i32 %a, 0
%b = sdiv i32 %a, zeroinitializer
ret i32 %b
}
define <2 x i32> @use_vector_sdiv_by_zero_x(<2 x i32> %a) nounwind {
; CHECK: Undefined behavior: Division by zero
; CHECK-NEXT: %b = sdiv <2 x i32> %a, <i32 0, i32 5>
%b = sdiv <2 x i32> %a, <i32 0, i32 5>
ret <2 x i32> %b
}
define <2 x i32> @use_vector_sdiv_by_zero_y(<2 x i32> %a) nounwind {
; CHECK: Undefined behavior: Division by zero
; CHECK-NEXT: %b = sdiv <2 x i32> %a, <i32 4, i32 0>
%b = sdiv <2 x i32> %a, <i32 4, i32 0>
ret <2 x i32> %b
}
define <2 x i32> @use_vector_sdiv_by_zero_xy(<2 x i32> %a) nounwind {
; CHECK: Undefined behavior: Division by zero
; CHECK-NEXT: %b = sdiv <2 x i32> %a, zeroinitializer
%b = sdiv <2 x i32> %a, <i32 0, i32 0>
ret <2 x i32> %b
}
define <2 x i32> @use_vector_sdiv_by_undef_x(<2 x i32> %a) nounwind {
; CHECK: Undefined behavior: Division by zero
; CHECK-NEXT: %b = sdiv <2 x i32> %a, <i32 undef, i32 5>
%b = sdiv <2 x i32> %a, <i32 undef, i32 5>
ret <2 x i32> %b
}
define <2 x i32> @use_vector_sdiv_by_undef_y(<2 x i32> %a) nounwind {
; CHECK: Undefined behavior: Division by zero
; CHECK-NEXT: %b = sdiv <2 x i32> %a, <i32 5, i32 undef>
%b = sdiv <2 x i32> %a, <i32 5, i32 undef>
ret <2 x i32> %b
}
define <2 x i32> @use_vector_sdiv_by_undef_xy(<2 x i32> %a) nounwind {
; CHECK: Undefined behavior: Division by zero
; CHECK-NEXT: %b = sdiv <2 x i32> %a, undef
%b = sdiv <2 x i32> %a, <i32 undef, i32 undef>
ret <2 x i32> %b
}

View File

@ -0,0 +1,109 @@
; RUN: opt -lint -disable-output < %s
; This test is meant to prove that the verifier does not report errors for correct
; use of the llvm.eh.begincatch and llvm.eh.endcatch intrinsics.
target triple = "x86_64-pc-windows-msvc"
declare void @llvm.eh.begincatch(i8*, i8*)
declare void @llvm.eh.endcatch()
@_ZTIi = external constant i8*
; Function Attrs: uwtable
define void @test_ref_clean() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
entry:
invoke void @_Z9may_throwv()
to label %try.cont unwind label %lpad
lpad: ; preds = %entry
%0 = landingpad { i8*, i32 }
catch i8* bitcast (i8** @_ZTIi to i8*)
%exn = extractvalue { i8*, i32 } %0, 0
%sel = extractvalue { i8*, i32 } %0, 1
%1 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*))
%matches = icmp eq i32 %sel, %1
br i1 %matches, label %catch, label %eh.resume
catch: ; preds = %lpad
call void @llvm.eh.begincatch(i8* %exn, i8* null)
call void @_Z10handle_intv()
br label %invoke.cont2
invoke.cont2: ; preds = %catch
call void @llvm.eh.endcatch()
br label %try.cont
try.cont: ; preds = %invoke.cont2, %entry
ret void
eh.resume: ; preds = %catch.dispatch
resume { i8*, i32 } %0
}
; Function Attrs: uwtable
define void @test_ref_clean_multibranch() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
entry:
invoke void @_Z9may_throwv()
to label %invoke.cont unwind label %lpad
invoke.cont:
invoke void @_Z9may_throwv()
to label %invoke.cont unwind label %lpad1
lpad: ; preds = %entry
%0 = landingpad { i8*, i32 }
catch i8* bitcast (i8** @_ZTIi to i8*)
%exn = extractvalue { i8*, i32 } %0, 0
%sel = extractvalue { i8*, i32 } %0, 1
%1 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*))
%matches = icmp eq i32 %sel, %1
br i1 %matches, label %catch, label %eh.resume
invoke void @_Z9may_throwv()
to label %try.cont unwind label %lpad
lpad1: ; preds = %entry
%l1.0 = landingpad { i8*, i32 }
cleanup
catch i8* bitcast (i8** @_ZTIi to i8*)
%exn1 = extractvalue { i8*, i32 } %l1.0, 0
%sel1 = extractvalue { i8*, i32 } %l1.0, 1
%l1.1 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*))
%matchesl1 = icmp eq i32 %sel1, %l1.1
br i1 %matchesl1, label %catch, label %eh.resume
catch: ; preds = %lpad, %lpad1
%exn2 = phi i8* [%exn, %lpad], [%exn1, %lpad1]
%sel2 = phi i32 [%sel, %lpad], [%sel1, %lpad1]
call void @llvm.eh.begincatch(i8* %exn2, i8* null)
call void @_Z10handle_intv()
%matches1 = icmp eq i32 %sel2, 0
br i1 %matches1, label %invoke.cont2, label %invoke.cont3
invoke.cont2: ; preds = %catch
call void @llvm.eh.endcatch()
br label %try.cont
invoke.cont3: ; preds = %catch
call void @llvm.eh.endcatch()
br label %eh.resume
try.cont: ; preds = %invoke.cont2, %entry
ret void
eh.resume: ; preds = %catch.dispatch
%lpad.val = insertvalue { i8*, i32 } undef, i32 0, 1
resume { i8*, i32 } %lpad.val
}
declare void @_Z9may_throwv()
declare i32 @__CxxFrameHandler3(...)
; Function Attrs: nounwind readnone
declare i32 @llvm.eh.typeid.for(i8*)
declare void @_Z10handle_intv()

View File

@ -0,0 +1 @@
config.suffixes = ['.ll']

View File

@ -0,0 +1,48 @@
; RUN: opt < %s -lint -disable-output 2>&1 | FileCheck %s
%s = type { i8 }
; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i1) #0
; Function Attrs: argmemonly nounwind
declare void @llvm.memset.p0i8.i8.i32(i8* nocapture writeonly, i8, i32, i32, i1) #0
declare void @f1(%s* noalias nocapture sret, %s* nocapture readnone)
define void @f2() {
entry:
%c = alloca %s
%tmp = alloca %s
%0 = bitcast %s* %c to i8*
%1 = bitcast %s* %tmp to i8*
call void @llvm.memset.p0i8.i8.i32(i8* %0, i8 0, i32 1, i32 1, i1 false)
call void @f1(%s* sret %c, %s* %c)
ret void
}
; Lint should complain about us passing %c to both arguments since one of them
; is noalias.
; CHECK: Unusual: noalias argument aliases another argument
; CHECK-NEXT: call void @f1(%s* sret %c, %s* %c)
declare void @f3(%s* noalias nocapture sret, %s* byval nocapture readnone)
define void @f4() {
entry:
%c = alloca %s
%tmp = alloca %s
%0 = bitcast %s* %c to i8*
%1 = bitcast %s* %tmp to i8*
call void @llvm.memset.p0i8.i8.i32(i8* %0, i8 0, i32 1, i32 1, i1 false)
call void @f3(%s* sret %c, %s* byval %c)
ret void
}
; Lint should not complain about passing %c to both arguments even if one is
; noalias, since the other one is byval, effectively copying the data to the
; stack instead of passing the pointer itself.
; CHECK-NOT: Unusual: noalias argument aliases another argument
; CHECK-NOT: call void @f3(%s* sret %c, %s* %c)
attributes #0 = { argmemonly nounwind }

View File

@ -0,0 +1,23 @@
; RUN: opt -lint < %s
; lint shouldn't crash on any of the below functions
@g_1 = external global [3 x i32]
@g_2 = external global [2 x i32]
define void @test1() {
entry:
tail call void @f1(i16 zext (i1 icmp eq (i32* getelementptr inbounds ([2 x i32], [2 x i32]* @g_2, i64 0, i64 0), i32* getelementptr inbounds ([3 x i32], [3 x i32]* @g_1, i64 0, i64 1)) to i16))
ret void
}
declare void @f1(i16)
define void @test2() {
tail call void inttoptr (i64 sext (i32 ptrtoint (void ()* @f2 to i32) to i64) to void ()*)()
ret void
}
declare void @f2()

View File

@ -0,0 +1,33 @@
; RUN: opt < %s -lint -disable-output 2>&1 | FileCheck %s
%s = type { i8 }
declare void @f1(%s*)
define void @f2() {
entry:
%c = alloca %s
tail call void @f1(%s* %c)
ret void
}
; Lint should complain about the tail call passing the alloca'd value %c to f1.
; CHECK: Undefined behavior: Call with "tail" keyword references alloca
; CHECK-NEXT: tail call void @f1(%s* %c)
declare void @f3(%s* byval)
define void @f4() {
entry:
%c = alloca %s
tail call void @f3(%s* byval %c)
ret void
}
; Lint should not complain about passing the alloca'd %c since it's passed
; byval, effectively copying the data to the stack instead of leaking the
; pointer itself.
; CHECK-NOT: Undefined behavior: Call with "tail" keyword references alloca
; CHECK-NOT: tail call void @f3(%s* byval %c)