Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/CallSiteSplitting/callsite-no-or-structure.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

140 lines
3.8 KiB
LLVM

; RUN: opt < %s -passes=callsite-splitting -S | FileCheck %s
; RUN: opt < %s -passes='function(callsite-splitting)' -S | FileCheck %s
; CHECK-LABEL: @test_simple
; CHECK-LABEL: Header:
; CHECK-NEXT: br i1 %arg, label %Header.split
; CHECK-LABEL: Header.split:
; CHECK: %[[CALL1:.*]] = call i32 @callee(ptr %a, i32 %v, i32 %p)
; CHECK-LABEL: TBB:
; CHECK: br i1 %cmp, label %TBB.split
; CHECK-LABEL: TBB.split:
; CHECK: %[[CALL2:.*]] = call i32 @callee(ptr null, i32 %v, i32 %p)
; CHECK-LABEL: Tail
; CHECK: %[[MERGED:.*]] = phi i32 [ %[[CALL1]], %Header.split ], [ %[[CALL2]], %TBB.split ]
; CHECK: ret i32 %[[MERGED]]
define i32 @test_simple(ptr %a, i32 %v, i32 %p, i1 %arg) {
Header:
br i1 %arg, label %Tail, label %End
TBB:
%cmp = icmp eq ptr %a, null
br i1 %cmp, label %Tail, label %End
Tail:
%r = call i32 @callee(ptr %a, i32 %v, i32 %p)
ret i32 %r
End:
ret i32 %v
}
; CHECK-LABEL: @test_eq_eq_eq_untaken
; CHECK-LABEL: Header:
; CHECK: br i1 %tobool1, label %TBB1, label %Header.split
; CHECK-LABEL: Header.split:
; CHECK: %[[CALL1:.*]] = call i32 @callee(ptr nonnull %a, i32 %v, i32 %p)
; CHECK-LABEL: TBB2:
; CHECK: br i1 %cmp2, label %TBB2.split, label %End
; CHECK-LABEL: TBB2.split:
; CHECK: %[[CALL2:.*]] = call i32 @callee(ptr null, i32 1, i32 99)
; CHECK-LABEL: Tail
; CHECK: %[[MERGED:.*]] = phi i32 [ %[[CALL1]], %Header.split ], [ %[[CALL2]], %TBB2.split ]
; CHECK: ret i32 %[[MERGED]]
define i32 @test_eq_eq_eq_untaken2(ptr %a, i32 %v, i32 %p) {
Header:
%tobool1 = icmp eq ptr %a, null
br i1 %tobool1, label %TBB1, label %Tail
TBB1:
%cmp1 = icmp eq i32 %v, 1
br i1 %cmp1, label %TBB2, label %End
TBB2:
%cmp2 = icmp eq i32 %p, 99
br i1 %cmp2, label %Tail, label %End
Tail:
%r = call i32 @callee(ptr %a, i32 %v, i32 %p)
ret i32 %r
End:
ret i32 %v
}
; CHECK-LABEL: @test_eq_ne_eq_untaken
; CHECK-LABEL: Header:
; CHECK: br i1 %tobool1, label %TBB1, label %Header.split
; CHECK-LABEL: Header.split:
; CHECK: %[[CALL1:.*]] = call i32 @callee(ptr nonnull %a, i32 %v, i32 %p)
; CHECK-LABEL: TBB2:
; CHECK: br i1 %cmp2, label %TBB2.split, label %End
; CHECK-LABEL: TBB2.split:
; CHECK: %[[CALL2:.*]] = call i32 @callee(ptr null, i32 %v, i32 99)
; CHECK-LABEL: Tail
; CHECK: %[[MERGED:.*]] = phi i32 [ %[[CALL1]], %Header.split ], [ %[[CALL2]], %TBB2.split ]
; CHECK: ret i32 %[[MERGED]]
define i32 @test_eq_ne_eq_untaken(ptr %a, i32 %v, i32 %p) {
Header:
%tobool1 = icmp eq ptr %a, null
br i1 %tobool1, label %TBB1, label %Tail
TBB1:
%cmp1 = icmp ne i32 %v, 1
br i1 %cmp1, label %TBB2, label %End
TBB2:
%cmp2 = icmp eq i32 %p, 99
br i1 %cmp2, label %Tail, label %End
Tail:
%r = call i32 @callee(ptr %a, i32 %v, i32 %p)
ret i32 %r
End:
ret i32 %v
}
; CHECK-LABEL: @test_header_header2_tbb
; CHECK: Header2:
; CHECK:br i1 %tobool2, label %Header2.split, label %TBB1
; CHECK-LABEL: Header2.split:
; CHECK: %[[CALL1:.*]] = call i32 @callee(ptr nonnull %a, i32 %v, i32 10)
; CHECK-LABEL: TBB2:
; CHECK: br i1 %cmp2, label %TBB2.split, label %End
; CHECK-LABEL: TBB2.split:
; NOTE: CallSiteSplitting cannot infer that %a is null here, as it currently
; only supports recording conditions along a single predecessor path.
; CHECK: %[[CALL2:.*]] = call i32 @callee(ptr %a, i32 1, i32 99)
; CHECK-LABEL: Tail
; CHECK: %[[MERGED:.*]] = phi i32 [ %[[CALL1]], %Header2.split ], [ %[[CALL2]], %TBB2.split ]
; CHECK: ret i32 %[[MERGED]]
define i32 @test_header_header2_tbb(ptr %a, i32 %v, i32 %p) {
Header:
%tobool1 = icmp eq ptr %a, null
br i1 %tobool1, label %TBB1, label %Header2
Header2:
%tobool2 = icmp eq i32 %p, 10
br i1 %tobool2, label %Tail, label %TBB1
TBB1:
%cmp1 = icmp eq i32 %v, 1
br i1 %cmp1, label %TBB2, label %End
TBB2:
%cmp2 = icmp eq i32 %p, 99
br i1 %cmp2, label %Tail, label %End
Tail:
%r = call i32 @callee(ptr %a, i32 %v, i32 %p)
ret i32 %r
End:
ret i32 %v
}
define i32 @callee(ptr %a, i32 %v, i32 %p) {
ret i32 10
}