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

67 lines
2.0 KiB
LLVM

; RUN: llc -fast-isel -stop-after=codegenprepare -mtriple=x86_64-unknown-linux-gnu -o - < %s | FileCheck %s
; Verify that CodeGenPrepare::splitBranchCondition installs the freshly
; computed (and scaled) branch weights on the two resulting branches.
;
; For an `or` of two conditions with original weights (A, B), the comment
; in splitBranchCondition prescribes:
; Br1 weights = (A, A + 2*B)
; Br2 weights = (A, 2*B)
;
; For an `and` of two conditions with original weights (A, B):
; Br1 weights = (2*A + B, B)
; Br2 weights = (2*A, B)
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
declare void @a()
declare void @b()
; CHECK-LABEL: define void @split_or
; CHECK: br i1 %c1, label %t, label %entry.cond.split, !prof [[OR_BR1:![0-9]+]]
; CHECK: br i1 %c2, label %t, label %f, !prof [[OR_BR2:![0-9]+]]
define void @split_or(i32 %x, i32 %y) {
entry:
%c1 = icmp eq i32 %x, 0
%c2 = icmp eq i32 %y, 0
%or = or i1 %c1, %c2
br i1 %or, label %t, label %f, !prof !0
t:
call void @a()
ret void
f:
call void @b()
ret void
}
; CHECK-LABEL: define void @split_and
; CHECK: br i1 %c1, label %entry.cond.split, label %f, !prof [[AND_BR1:![0-9]+]]
; CHECK: br i1 %c2, label %t, label %f, !prof [[AND_BR2:![0-9]+]]
define void @split_and(i32 %x, i32 %y) {
entry:
%c1 = icmp eq i32 %x, 0
%c2 = icmp eq i32 %y, 0
%and = and i1 %c1, %c2
br i1 %and, label %t, label %f, !prof !0
t:
call void @a()
ret void
f:
call void @b()
ret void
}
!0 = !{!"branch_weights", i32 100, i32 7}
; Expected freshly-computed weights:
; OR Br1: (100, 100 + 2*7) = (100, 114)
; OR Br2: (100, 2*7) = (100, 14)
; AND Br1: (2*100 + 7, 7) = (207, 7)
; AND Br2: (2*100, 7) = (200, 7)
; CHECK-DAG: [[OR_BR1]] = !{!"branch_weights", i32 100, i32 114}
; CHECK-DAG: [[OR_BR2]] = !{!"branch_weights", i32 100, i32 14}
; CHECK-DAG: [[AND_BR1]] = !{!"branch_weights", i32 207, i32 7}
; CHECK-DAG: [[AND_BR2]] = !{!"branch_weights", i32 200, i32 7}