Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/X86/pgo-profile-o0.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

50 lines
2.0 KiB
LLVM

; RUN: llc -mtriple=x86_64-- -O0 -pgo-kind=pgo-sample-use-pipeline -debug-pass=Structure %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=PASSES
; RUN: llc -mtriple=x86_64-- -O0 -pgo-kind=pgo-sample-use-pipeline -debug-only=branch-prob %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=BRANCH_PROB
; RUN: llc -mtriple=x86_64-- -O0 -pgo-kind=pgo-sample-use-pipeline -stop-after=finalize-isel %s -o - | FileCheck %s --check-prefix=MIR
; REQUIRES: asserts
; This test verifies that PGO profile information (branch weights) is preserved
; during instruction selection at -O0.
; Test function with explicit branch weights from PGO.
define i32 @test_pgo_preservation(i32 %x) !prof !15 {
entry:
%cmp = icmp sgt i32 %x, 10
; This branch has bias: 97 taken vs 3 not taken
br i1 %cmp, label %if.then, label %if.else, !prof !16
if.then:
; Hot path - should have high frequency
%add = add nsw i32 %x, 100
br label %if.end
if.else:
; Cold path - should have low frequency
%sub = sub nsw i32 %x, 50
br label %if.end
if.end:
%result = phi i32 [ %add, %if.then ], [ %sub, %if.else ]
ret i32 %result
}
; Profile metadata with branch weights 97:3.
!15 = !{!"function_entry_count", i64 100}
!16 = !{!"branch_weights", i32 97, i32 3}
; Verify that Branch Probability Analysis runs at O0.
; PASSES: Branch Probability Analysis
; Verify that the branch probabilities reflect the exact profile data.
; BRANCH_PROB: ---- Branch Probability Info : test_pgo_preservation ----
; BRANCH_PROB: set edge entry -> 0 successor probability to {{.*}} = 97.00%
; BRANCH_PROB: set edge entry -> 1 successor probability to {{.*}} = 3.00%
; Verify that machine IR preserves the branch probabilities from profile data
; MIR: bb.0.entry:
; MIR-NEXT: successors: %bb.{{[0-9]+}}({{0x03d70a3d|0x7c28f5c3}}), %bb.{{[0-9]+}}({{0x7c28f5c3|0x03d70a3d}})
; The two successor probability values should be:
; - 0x7c28f5c3: approximately 97% (high probability successor)
; - 0x03d70a3d: approximately 3% (low probability successor)