Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/PGOProfile/profcheck-select.ll
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

86 lines
2.6 KiB
LLVM

; This test fails under the profcheck configuration due to profcheck creating
; metadata.
; UNSUPPORTED: profcheck
; RUN: split-file %s %t
; RUN: opt -passes=prof-inject %t/inject.ll -S -o - | FileCheck %t/inject.ll
; RUN: opt -passes=prof-inject %t/inject-some.ll \
; RUN: -profcheck-default-select-true-weight=1 -profcheck-default-select-false-weight=6 \
; RUN: -S -o - | FileCheck %t/inject-some.ll
; RUN: opt -passes=prof-verify %t/verify.ll 2>&1 | FileCheck %t/verify.ll
; RUN: not opt -passes=prof-verify %t/verify-missing.ll 2>&1 | FileCheck %t/verify-missing.ll
; verify we can disable it. It's sufficient to see opt not failing.
; RUN: opt -passes=prof-verify -profcheck-annotate-select=0 --disable-output %t/verify-missing.ll
; verify vector selects without profiles are OK. It's sufficient opt doesn't fail.
; RUN: opt -passes=prof-verify --disable-output %t/verify-vec.ll
;--- inject.ll
declare void @foo(i32 %a);
define void @bar(i1 %c) {
%v = select i1 %c, i32 1, i32 2
call void @foo(i32 %v)
ret void
}
define <2 x i32> @vec(<2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2) {
%r = select <2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2
ret <2 x i32> %r
}
; CHECK-LABEL: @bar
; CHECK: %v = select i1 %c, i32 1, i32 2, !prof !1
; CHECK-LABEL: @vec
; CHECK-NOT: select {{.*}} !prof
; CHECK: !0 = !{!"function_entry_count", i64 1000}
; CHECK: !1 = !{!"branch_weights", i32 2, i32 3}
;--- inject-some.ll
declare void @foo(i32 %a);
define void @bar(i1 %c) {
%e = select i1 %c, i32 1, i32 2, !prof !0
%c2 = icmp eq i32 %e, 2
%v = select i1 %c2, i32 5, i32 10
call void @foo(i32 %v)
ret void
}
!0 = !{!"branch_weights", i32 2, i32 3}
; CHECK-LABEL: @bar
; CHECK: %v = select i1 %c2, i32 5, i32 10, !prof !2
; CHECK: !0 = !{!"function_entry_count", i64 1000}
; CHECK: !1 = !{!"branch_weights", i32 2, i32 3}
; CHECK: !2 = !{!"branch_weights", i32 1, i32 6}
;--- verify.ll
declare void @foo(i32 %a);
define void @bar(i1 %c) !prof !0 {
%v = select i1 %c, i32 1, i32 2, !prof !1
call void @foo(i32 %v)
ret void
}
!0 = !{!"function_entry_count", i64 1000}
!1 = !{!"branch_weights", i32 1, i32 7}
; CHECK-NOT: Profile verification failed for function 'bar': select annotation missing
;--- verify-missing.ll
declare void @foo(i32 %a);
define void @bar(i1 %c) !prof !0 {
%v = select i1 %c, i32 1, i32 2
call void @foo(i32 %v)
ret void
}
!0 = !{!"function_entry_count", i64 1000}
; CHECK: Profile verification failed for function 'bar': select annotation missing
;--- verify-vec.ll
define <2 x i32> @vec(<2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2) !prof !{!"function_entry_count", i32 10} {
%r = select <2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2
ret <2 x i32> %r
}