Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-profile.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

90 lines
2.4 KiB
LLVM

; RUN: split-file %s %t
; RUN: cat %t/main.ll %t/probable-or.prof > %t/probable-or.ll
; RUN: cat %t/main.ll %t/probable-and.prof > %t/probable-and.ll
; RUN: opt -passes='loop(simple-loop-unswitch<nontrivial>)' -S %t/probable-or.ll -o -| FileCheck %t/probable-or.prof
; RUN: opt -passes='loop(simple-loop-unswitch<nontrivial>)' -S %t/probable-and.ll -o -| FileCheck %t/probable-and.prof
;--- main.ll
declare i32 @a()
declare i32 @b()
define i32 @or(ptr %ptr, i1 %cond) !prof !0 {
entry:
br label %loop_begin
loop_begin:
%v1 = load i1, ptr %ptr
%cond_or = or i1 %v1, %cond
br i1 %cond_or, label %loop_a, label %loop_b, !prof !1
loop_a:
call i32 @a()
br label %latch
loop_b:
call i32 @b()
br label %latch
latch:
%v2 = load i1, ptr %ptr
br i1 %v2, label %loop_begin, label %loop_exit, !prof !2
loop_exit:
ret i32 0
}
define i32 @and(ptr %ptr, i1 %cond) !prof !0 {
entry:
br label %loop_begin
loop_begin:
%v1 = load i1, ptr %ptr
%cond_and = and i1 %v1, %cond
br i1 %cond_and, label %loop_a, label %loop_b, !prof !1
loop_a:
call i32 @a()
br label %latch
loop_b:
call i32 @b()
br label %latch
latch:
%v2 = load i1, ptr %ptr
br i1 %v2, label %loop_begin, label %loop_exit, !prof !2
loop_exit:
ret i32 0
}
;--- probable-or.prof
!0 = !{!"function_entry_count", i32 10}
!1 = !{!"branch_weights", i32 1, i32 1000}
!2 = !{!"branch_weights", i32 5, i32 7}
; CHECK-LABEL: @or
; CHECK-LABEL: entry:
; CHECK-NEXT: %cond.fr = freeze i1 %cond
; CHECK-NEXT: br i1 %cond.fr, label %entry.split.us, label %entry.split, !prof !1
; CHECK-LABEL: @and
; CHECK-LABEL: entry:
; CHECK-NEXT: %cond.fr = freeze i1 %cond
; CHECK-NEXT: br i1 %cond.fr, label %entry.split, label %entry.split.us, !prof !3
; CHECK: !1 = !{!"branch_weights", i32 1, i32 1000}
; CHECK: !3 = !{!"unknown", !"simple-loop-unswitch"}
;--- probable-and.prof
!0 = !{!"function_entry_count", i32 10}
!1 = !{!"branch_weights", i32 1000, i32 1}
!2 = !{!"branch_weights", i32 5, i32 7}
; CHECK-LABEL: @or
; CHECK-LABEL: entry:
; CHECK-NEXT: %cond.fr = freeze i1 %cond
; CHECK-NEXT: br i1 %cond.fr, label %entry.split.us, label %entry.split, !prof !1
; CHECK-LABEL: @and
; CHECK-LABEL: entry:
; CHECK-NEXT: %cond.fr = freeze i1 %cond
; CHECK-NEXT: br i1 %cond.fr, label %entry.split, label %entry.split.us, !prof !3
; CHECK: !1 = !{!"unknown", !"simple-loop-unswitch"}
; CHECK: !3 = !{!"branch_weights", i32 1000, i32 1}