mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-05 18:27:59 +00:00
9c5542c040
Now that `Metadata` is typeless, reflect that in the assembly. These are the matching assembly changes for the metadata/value split in r223802. - Only use the `metadata` type when referencing metadata from a call intrinsic -- i.e., only when it's used as a `Value`. - Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode` when referencing it from call intrinsics. So, assembly like this: define @foo(i32 %v) { call void @llvm.foo(metadata !{i32 %v}, metadata !0) call void @llvm.foo(metadata !{i32 7}, metadata !0) call void @llvm.foo(metadata !1, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{metadata !3}, metadata !0) ret void, !bar !2 } !0 = metadata !{metadata !2} !1 = metadata !{i32* @global} !2 = metadata !{metadata !3} !3 = metadata !{} turns into this: define @foo(i32 %v) { call void @llvm.foo(metadata i32 %v, metadata !0) call void @llvm.foo(metadata i32 7, metadata !0) call void @llvm.foo(metadata i32* @global, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{!3}, metadata !0) ret void, !bar !2 } !0 = !{!2} !1 = !{i32* @global} !2 = !{!3} !3 = !{} I wrote an upgrade script that handled almost all of the tests in llvm and many of the tests in cfe (even handling many `CHECK` lines). I've attached it (or will attach it in a moment if you're speedy) to PR21532 to help everyone update their out-of-tree testcases. This is part of PR21532. llvm-svn: 224257
152 lines
2.9 KiB
LLVM
152 lines
2.9 KiB
LLVM
; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
|
|
|
|
define void @f1(i8* %x) {
|
|
entry:
|
|
store i8 0, i8* %x, align 1, !range !0
|
|
ret void
|
|
}
|
|
!0 = !{i8 0, i8 1}
|
|
; CHECK: Ranges are only for loads, calls and invokes!
|
|
; CHECK-NEXT: store i8 0, i8* %x, align 1, !range !0
|
|
|
|
define i8 @f2(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !1
|
|
ret i8 %y
|
|
}
|
|
!1 = !{}
|
|
; CHECK: It should have at least one range!
|
|
; CHECK-NEXT: metadata
|
|
|
|
define i8 @f3(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !2
|
|
ret i8 %y
|
|
}
|
|
!2 = !{i8 0}
|
|
; CHECK: Unfinished range!
|
|
|
|
define i8 @f4(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !3
|
|
ret i8 %y
|
|
}
|
|
!3 = !{double 0.0, i8 0}
|
|
; CHECK: The lower limit must be an integer!
|
|
|
|
define i8 @f5(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !4
|
|
ret i8 %y
|
|
}
|
|
!4 = !{i8 0, double 0.0}
|
|
; CHECK: The upper limit must be an integer!
|
|
|
|
define i8 @f6(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !5
|
|
ret i8 %y
|
|
}
|
|
!5 = !{i32 0, i8 0}
|
|
; CHECK: Range types must match instruction type!
|
|
; CHECK: %y = load
|
|
|
|
define i8 @f7(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !6
|
|
ret i8 %y
|
|
}
|
|
!6 = !{i8 0, i32 0}
|
|
; CHECK: Range types must match instruction type!
|
|
; CHECK: %y = load
|
|
|
|
define i8 @f8(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !7
|
|
ret i8 %y
|
|
}
|
|
!7 = !{i32 0, i32 0}
|
|
; CHECK: Range types must match instruction type!
|
|
; CHECK: %y = load
|
|
|
|
define i8 @f9(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !8
|
|
ret i8 %y
|
|
}
|
|
!8 = !{i8 0, i8 0}
|
|
; CHECK: Range must not be empty!
|
|
|
|
define i8 @f10(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !9
|
|
ret i8 %y
|
|
}
|
|
!9 = !{i8 0, i8 2, i8 1, i8 3}
|
|
; CHECK: Intervals are overlapping
|
|
|
|
define i8 @f11(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !10
|
|
ret i8 %y
|
|
}
|
|
!10 = !{i8 0, i8 2, i8 2, i8 3}
|
|
; CHECK: Intervals are contiguous
|
|
|
|
define i8 @f12(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !11
|
|
ret i8 %y
|
|
}
|
|
!11 = !{i8 1, i8 2, i8 -1, i8 0}
|
|
; CHECK: Intervals are not in order
|
|
|
|
define i8 @f13(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !12
|
|
ret i8 %y
|
|
}
|
|
!12 = !{i8 1, i8 3, i8 5, i8 1}
|
|
; CHECK: Intervals are contiguous
|
|
|
|
define i8 @f14(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !13
|
|
ret i8 %y
|
|
}
|
|
!13 = !{i8 1, i8 3, i8 5, i8 2}
|
|
; CHECK: Intervals are overlapping
|
|
|
|
define i8 @f15(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !14
|
|
ret i8 %y
|
|
}
|
|
!14 = !{i8 10, i8 1, i8 12, i8 13}
|
|
; CHECK: Intervals are overlapping
|
|
|
|
define i8 @f16(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !16
|
|
ret i8 %y
|
|
}
|
|
!16 = !{i8 1, i8 3, i8 4, i8 5, i8 6, i8 2}
|
|
; CHECK: Intervals are overlapping
|
|
|
|
define i8 @f17(i8* %x) {
|
|
entry:
|
|
%y = load i8* %x, align 1, !range !17
|
|
ret i8 %y
|
|
}
|
|
!17 = !{i8 1, i8 3, i8 4, i8 5, i8 6, i8 1}
|
|
; CHECK: Intervals are contiguous
|
|
|
|
define i8 @f18() {
|
|
entry:
|
|
%y = call i8 undef(), !range !18
|
|
ret i8 %y
|
|
}
|
|
!18 = !{}
|
|
; CHECK: It should have at least one range!
|
|
; CHECK-NEXT: metadata
|