blob: 45c8fa0c6bb167036b2ea00ac951b8295fe32e42 [file]
; Test MD_prof "VP" validation
; RUN: split-file %s %t
; RUN: opt -passes=verify %t/valid.ll --disable-output
; RUN: not opt -passes=verify %t/invalid-kind.ll --disable-output 2>&1 | FileCheck %s --check-prefix=INVALID-KIND
; RUN: not opt -passes=verify %t/invalid-count.ll --disable-output 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT
; RUN: not opt -passes=verify %t/invalid-place.ll --disable-output 2>&1 | FileCheck %s --check-prefix=INVALID-PLACE
; RUN: not opt -passes=verify %t/invalid-duplicate-values.ll -disable-output 2>&1 | FileCheck %s --check-prefix=INVALID-DUPLICATE-VALUES
; RUN: not opt -passes=verify %t/invalid-value-not-const-int.ll -disable-output 2>&1 | FileCheck %s --check-prefix=INVALID-VALUE-NOT-CONST-INT
;--- valid.ll
define void @test(ptr %0) {
call void %0(), !prof !0
ret void
}
!0 = !{!"VP", i32 0, i32 20, i64 1234, i64 10, i64 5678, i64 5}
;--- invalid-kind.ll
define void @test(ptr %0) {
call void %0(), !prof !0
ret void
}
!0 = !{!"VP", i32 3, i32 20, i64 1234, i64 10, i64 5678, i64 5}
; INVALID-KIND: Invalid VP !prof kind
;--- invalid-count.ll
define void @test(ptr %0) {
call void %0(), !prof !0
ret void
}
!0 = !{!"VP", i32 1, i64 1234, i64 10, i64 5678, i64 5}
; INVALID-COUNT: VP !prof should have an even number of arguments after 'VP'
;--- invalid-place.ll
define i32 @test(i32 %0) {
%r = add i32 %0, 1, !prof !0
ret i32 %r
}
!0 = !{!"VP", i32 1, i32 20, i64 1234, i64 10, i64 5678, i64 5}
; INVALID-PLACE: VP !prof indirect call or memop size expected to be applied to CallBase instructions only
;--- invalid-duplicate-values.ll
define void @test(ptr %0) {
call void %0(), !prof !0
ret void
}
!0 = !{!"VP", i32 0, i64 1234, i64 72657670687977694852, i64 1, i64 72657670687977694852, i64 2}
; INVALID-DUPLICATE-VALUES: VP !prof should not have duplicate profile values
;--- invalid-value-not-const-int.ll
define void @test(ptr %0) {
call void %0(), !prof !0
ret void
}
!0 = !{!"VP", i32 0, i64 100, !"oops", i64 50}
; INVALID-VALUE-NOT-CONST-INT: VP !prof value operand is not a const int