Files
TheRock/compiler/amd-llvm/mlir/test/Target/LLVMIR/Import/metadata-profiling.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

108 lines
2.2 KiB
LLVM

; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s
; CHECK-LABEL: @cond_br
define i64 @cond_br(i1 %arg1, i64 %arg2) {
entry:
; CHECK: llvm.cond_br
; CHECK-SAME: weights([0, 3])
br i1 %arg1, label %bb1, label %bb2, !prof !0
bb1:
ret i64 %arg2
bb2:
ret i64 %arg2
}
!0 = !{!"branch_weights", i32 0, i32 3}
; // -----
; CHECK-LABEL: @cond_br_expected
define i64 @cond_br_expected(i1 %arg1, i64 %arg2) {
entry:
; CHECK: llvm.cond_br
; CHECK-SAME: weights([1, 2000])
br i1 %arg1, label %bb1, label %bb2, !prof !0
bb1:
ret i64 %arg2
bb2:
ret i64 %arg2
}
!0 = !{!"branch_weights", !"expected", i32 1, i32 2000}
; // -----
; CHECK-LABEL: @simple_switch(
define i32 @simple_switch(i32 %arg1) {
; CHECK: llvm.switch
; CHECK: {branch_weights = array<i32: 42, 3, 5>}
switch i32 %arg1, label %bbd [
i32 0, label %bb1
i32 9, label %bb2
], !prof !0
bb1:
ret i32 %arg1
bb2:
ret i32 %arg1
bbd:
ret i32 %arg1
}
!0 = !{!"branch_weights", i32 42, i32 3, i32 5}
; // -----
; CHECK-LABEL: @simple_switch_expected(
define i32 @simple_switch_expected(i32 %arg1) {
; CHECK: llvm.switch
; CHECK: {branch_weights = array<i32: 1, 1, 2000>}
switch i32 %arg1, label %bbd [
i32 0, label %bb1
i32 9, label %bb2
], !prof !0
bb1:
ret i32 %arg1
bb2:
ret i32 %arg1
bbd:
ret i32 %arg1
}
!0 = !{!"branch_weights", !"expected", i32 1, i32 1, i32 2000}
; // -----
; Verify that a single weight attached to a call is not translated.
; The MLIR WeightedBranchOpInterface does not support this case.
; CHECK: llvm.func @fn()
declare i32 @fn()
; CHECK-LABEL: @call_branch_weights
define i32 @call_branch_weights() {
; CHECK: llvm.call @fn() : () -> i32
%1 = call i32 @fn(), !prof !0
ret i32 %1
}
!0 = !{!"branch_weights", i32 42}
; // -----
declare void @foo()
declare i32 @__gxx_personality_v0(...)
; CHECK-LABEL: @invoke_branch_weights
define i32 @invoke_branch_weights() personality ptr @__gxx_personality_v0 {
; CHECK: llvm.invoke @foo() to ^bb2 unwind ^bb1 {branch_weights = array<i32: 42, 99>} : () -> ()
invoke void @foo() to label %bb2 unwind label %bb1, !prof !0
bb1:
%1 = landingpad { ptr, i32 } cleanup
br label %bb2
bb2:
ret i32 1
}
!0 = !{!"branch_weights", i32 42, i32 99}