Files
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

95 lines
3.3 KiB
LLVM

; REQUIRES: asserts && x86_64-linux
; Check that the profile annotator works: we hit an exit and non-zero paths to
; already visited blocks count as taken (i.e. the flow continues through them).
;
; RUN: split-file %s %t
; RUN: llvm-ctxprof-util fromYAML --input=%t/profile_ok.yaml --output=%t/profile_ok.ctxprofdata
; RUN: llvm-ctxprof-util fromYAML --input=%t/profile_pump.yaml --output=%t/profile_pump.ctxprofdata
; RUN: llvm-ctxprof-util fromYAML --input=%t/profile_unreachable.yaml --output=%t/profile_unreachable.ctxprofdata
;
; RUN: opt -passes=ctx-prof-flatten %t/example_ok.ll -ctx-profile-force-is-specialized -use-ctx-profile=%t/profile_ok.ctxprofdata -S -o - | FileCheck %s
; RUN: not --crash opt -passes=ctx-prof-flatten %t/message_pump.ll -ctx-profile-force-is-specialized -use-ctx-profile=%t/profile_pump.ctxprofdata -S 2>&1 | FileCheck %s --check-prefix=ASSERTION
; RUN: not --crash opt -passes=ctx-prof-flatten %t/unreachable.ll -ctx-profile-force-is-specialized -use-ctx-profile=%t/profile_unreachable.ctxprofdata -S 2>&1 | FileCheck %s --check-prefix=ASSERTION
; CHECK: br i1 %x, label %b1, label %exit, !prof ![[PROF1:[0-9]+]]
; CHECK: br i1 %y, label %blk, label %exit, !prof ![[PROF2:[0-9]+]]
; CHECK: ![[PROF1]] = !{!"branch_weights", i32 2, i32 2}
; CHECK: ![[PROF2]] = !{!"branch_weights", i32 0, i32 2}
; ASSERTION: Assertion `allTakenPathsExit()
; b1->exit is the only way out from b1, but the exit block would have been
; already visited from blk. That should not result in an assertion, though.
;--- example_ok.ll
define void @foo(i32 %t) !guid !0 {
entry:
call void @llvm.instrprof.increment(ptr @foo, i64 42, i32 42, i32 0)
br label %blk
blk:
call void @llvm.instrprof.increment(ptr @foo, i64 42, i32 42, i32 1)
%x = icmp eq i32 %t, 0
br i1 %x, label %b1, label %exit
b1:
call void @llvm.instrprof.increment(ptr @foo, i64 42, i32 42, i32 2)
%y = icmp eq i32 %t, 0
br i1 %y, label %blk, label %exit
exit:
call void @llvm.instrprof.increment(ptr @foo, i64 42, i32 42, i32 3)
ret void
}
!0 = !{i64 1234}
;--- profile_ok.yaml
Contexts:
- Guid: 1234
TotalRootEntryCount: 2
Counters: [2, 2, 1, 2]
;--- message_pump.ll
; This is a message pump: the loop never exits. This should result in an
; assertion because we can't reach an exit BB
define void @foo(i32 %t) !guid !0 {
entry:
call void @llvm.instrprof.increment(ptr @foo, i64 42, i32 42, i32 0)
br label %blk
blk:
call void @llvm.instrprof.increment(ptr @foo, i64 42, i32 42, i32 1)
%x = icmp eq i32 %t, 0
br i1 %x, label %blk, label %exit
exit:
call void @llvm.instrprof.increment(ptr @foo, i64 42, i32 42, i32 2)
ret void
}
!0 = !{i64 1234}
;--- profile_pump.yaml
Contexts:
- Guid: 1234
TotalRootEntryCount: 2
Counters: [2, 10, 0]
;--- unreachable.ll
; An unreachable block is reached, that's an error
define void @foo(i32 %t) !guid !0 {
entry:
call void @llvm.instrprof.increment(ptr @foo, i64 42, i32 42, i32 0)
br label %blk
blk:
call void @llvm.instrprof.increment(ptr @foo, i64 42, i32 42, i32 1)
%x = icmp eq i32 %t, 0
br i1 %x, label %b1, label %exit
b1:
call void @llvm.instrprof.increment(ptr @foo, i64 42, i32 42, i32 2)
unreachable
exit:
call void @llvm.instrprof.increment(ptr @foo, i64 42, i32 42, i32 3)
ret void
}
!0 = !{i64 1234}
;--- profile_unreachable.yaml
Contexts:
- Guid: 1234
TotalRootEntryCount: 2
Counters: [2, 1, 1, 2]