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

87 lines
3.2 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' %s | FileCheck %s
target triple = "x86_64--linux-gnu"
@foo = dso_local thread_local(localexec) global i32 0, align 4
declare void @effect()
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull)
define i32 @func0(i32 %arg) {
; CHECK-LABEL: define i32 @func0(
; CHECK-SAME: i32 [[ARG:%.*]]) {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[ADDR:%.*]] = tail call ptr @llvm.threadlocal.address.p0(ptr @foo)
; CHECK-NEXT: [[LOAD0:%.*]] = load i32, ptr [[ADDR]], align 4
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[ARG]], 0
; CHECK-NEXT: br i1 [[COND]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
; CHECK: if.then:
; CHECK-NEXT: tail call void @effect()
; CHECK-NEXT: [[TMP0:%.*]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @foo)
; CHECK-NEXT: [[LOAD1:%.*]] = load i32, ptr [[TMP0]], align 4
; CHECK-NEXT: br label [[IF_END]]
; CHECK: if.end:
; CHECK-NEXT: [[PHI:%.*]] = phi i32 [ [[LOAD1]], [[IF_THEN]] ], [ [[LOAD0]], [[ENTRY:%.*]] ]
; CHECK-NEXT: [[RET:%.*]] = add i32 [[PHI]], [[LOAD0]]
; CHECK-NEXT: ret i32 [[RET]]
;
entry:
%addr = tail call ptr @llvm.threadlocal.address.p0(ptr @foo)
%load0 = load i32, ptr %addr, align 4
%cond = icmp eq i32 %arg, 0
br i1 %cond, label %if.then, label %if.end
if.then:
tail call void @effect()
%load1 = load i32, ptr %addr, align 4
br label %if.end
if.end:
%phi = phi i32 [ %load1, %if.then ], [ %load0, %entry ]
%ret = add i32 %phi, %load0
ret i32 %ret
}
define i32 @func1(i32 %arg0, i32 %arg1) {
; CHECK-LABEL: define i32 @func1(
; CHECK-SAME: i32 [[ARG0:%.*]], i32 [[ARG1:%.*]]) {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[ADDR:%.*]] = tail call ptr @llvm.threadlocal.address.p0(ptr @foo)
; CHECK-NEXT: [[LOAD0:%.*]] = load i32, ptr [[ADDR]], align 4
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[ARG0]], 0
; CHECK-NEXT: br i1 [[COND]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
; CHECK: if.then:
; CHECK-NEXT: tail call void @effect()
; CHECK-NEXT: [[X:%.*]] = add i32 [[ARG1]], 42
; CHECK-NEXT: [[X64:%.*]] = sext i32 [[X]] to i64
; CHECK-NEXT: [[TMP0:%.*]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @foo)
; CHECK-NEXT: [[SUNKADDR:%.*]] = mul i64 [[X64]], 4
; CHECK-NEXT: [[ADDR1:%.*]] = getelementptr inbounds i8, ptr [[TMP0]], i64 [[SUNKADDR]]
; CHECK-NEXT: [[LOAD1:%.*]] = load i32, ptr [[ADDR1]], align 4
; CHECK-NEXT: br label [[IF_END]]
; CHECK: if.end:
; CHECK-NEXT: [[PHI:%.*]] = phi i32 [ [[LOAD1]], [[IF_THEN]] ], [ [[LOAD0]], [[ENTRY:%.*]] ]
; CHECK-NEXT: [[RET:%.*]] = add i32 [[PHI]], [[LOAD0]]
; CHECK-NEXT: ret i32 [[RET]]
;
entry:
%addr = tail call ptr @llvm.threadlocal.address.p0(ptr @foo)
%load0 = load i32, ptr %addr, align 4
%cond = icmp eq i32 %arg0, 0
br i1 %cond, label %if.then, label %if.end
if.then:
tail call void @effect()
%x = add i32 %arg1, 42
%x64 = sext i32 %x to i64
%addr1 = getelementptr inbounds i32, ptr %addr, i64 %x64
%load1 = load i32, ptr %addr1, align 4
br label %if.end
if.end:
%phi = phi i32 [ %load1, %if.then ], [ %load0, %entry ]
%ret = add i32 %phi, %load0
ret i32 %ret
}