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

117 lines
3.5 KiB
LLVM

; RUN: opt -S -passes=hotcoldsplit -hotcoldsplit-threshold=0 < %s | FileCheck %s
; Source:
;
; extern void sideeffect(int);
; extern void __attribute__((cold)) sink();
; void foo(int cond) {
; if (cond) { //< Start outlining here.
; while (cond > 10) {
; --cond;
; sideeffect(0);
; }
; sink();
; }
; sideeffect(1);
; }
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.14.0"
; CHECK-LABEL: define {{.*}}@foo(
; CHECK: br i1 {{.*}}, label %if.end, label %codeRepl
; CHECK-LABEL: codeRepl:
; CHECK-NEXT: call void @foo.cold.1
; CHECK-LABEL: if.end:
; CHECK: call void @sideeffect(i32 1)
define void @foo(i32 %cond) {
entry:
%tobool = icmp eq i32 %cond, 0
br i1 %tobool, label %if.end, label %while.cond.preheader
while.cond.preheader: ; preds = %entry
%cmp3 = icmp sgt i32 %cond, 10
br i1 %cmp3, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %while.cond.preheader
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%cond.addr.04 = phi i32 [ %dec, %while.body ], [ %cond, %while.body.preheader ]
%dec = add nsw i32 %cond.addr.04, -1
tail call void @sideeffect(i32 0) #3
%cmp = icmp sgt i32 %dec, 10
br i1 %cmp, label %while.body, label %while.end.loopexit
while.end.loopexit: ; preds = %while.body
br label %while.end
while.end: ; preds = %while.end.loopexit, %while.cond.preheader
tail call void (...) @sink()
ret void
if.end: ; preds = %entry
tail call void @sideeffect(i32 1)
ret void
}
; This is the same as @foo, but the while loop comes after the sink block.
; CHECK-LABEL: define {{.*}}@while_loop_after_sink(
; CHECK: br i1 {{.*}}, label %if.end, label %codeRepl
; CHECK-LABEL: codeRepl:
; CHECK-NEXT: call void @while_loop_after_sink.cold.1
; CHECK-LABEL: if.end:
; CHECK: call void @sideeffect(i32 1)
define void @while_loop_after_sink(i32 %cond) {
entry:
%tobool = icmp eq i32 %cond, 0
br i1 %tobool, label %if.end, label %sink
sink:
tail call void (...) @sink()
br label %while.cond.preheader
while.cond.preheader:
%cmp3 = icmp sgt i32 %cond, 10
br i1 %cmp3, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %while.cond.preheader
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%cond.addr.04 = phi i32 [ %dec, %while.body ], [ %cond, %while.body.preheader ]
%dec = add nsw i32 %cond.addr.04, -1
tail call void @sideeffect(i32 0) #3
%cmp = icmp sgt i32 %dec, 10
br i1 %cmp, label %while.body, label %while.end.loopexit
while.end.loopexit: ; preds = %while.body
br label %while.end
while.end: ; preds = %while.end.loopexit, %while.cond.preheader
ret void
if.end: ; preds = %entry
tail call void @sideeffect(i32 1)
ret void
}
; CHECK-LABEL: define {{.*}}@foo.cold.1
; CHECK: phi i32
; CHECK-NEXT: add nsw i32
; CHECK-NEXT: call {{.*}}@sideeffect
; CHECK-NEXT: icmp
; CHECK-NEXT: br
; CHECK-LABEL: define {{.*}}@while_loop_after_sink.cold.1
; CHECK: call {{.*}}@sink
; CHECK: phi i32
; CHECK-NEXT: add nsw i32
; CHECK-NEXT: call {{.*}}@sideeffect
; CHECK-NEXT: icmp
; CHECK-NEXT: br
declare void @sideeffect(i32)
declare void @sink(...) cold