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

154 lines
4.0 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes=instcombine < %s | FileCheck %s
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
; Positive test - all uses are identical casts.
define void @t0(i1 zeroext %c0, i1 zeroext %c1, ptr nocapture readonly %src) {
; CHECK-LABEL: @t0(
; CHECK-NEXT: bb:
; CHECK-NEXT: [[DATA:%.*]] = load i64, ptr [[SRC:%.*]], align 8
; CHECK-NEXT: br i1 [[C0:%.*]], label [[BB3:%.*]], label [[BB7:%.*]]
; CHECK: bb3:
; CHECK-NEXT: br i1 [[C1:%.*]], label [[BB4:%.*]], label [[BB5:%.*]]
; CHECK: bb4:
; CHECK-NEXT: tail call void @abort()
; CHECK-NEXT: unreachable
; CHECK: bb5:
; CHECK-NEXT: [[PTR0:%.*]] = inttoptr i64 [[DATA]] to ptr
; CHECK-NEXT: tail call void @sink0(ptr [[PTR0]])
; CHECK-NEXT: br label [[BB9:%.*]]
; CHECK: bb7:
; CHECK-NEXT: [[PTR1:%.*]] = inttoptr i64 [[DATA]] to ptr
; CHECK-NEXT: tail call void @sink1(ptr [[PTR1]])
; CHECK-NEXT: br label [[BB9]]
; CHECK: bb9:
; CHECK-NEXT: ret void
;
bb:
%data = load i64, ptr %src, align 8
br i1 %c0, label %bb3, label %bb7
bb3:
br i1 %c1, label %bb4, label %bb5
bb4:
tail call void @abort()
unreachable
bb5:
%ptr0 = inttoptr i64 %data to ptr
tail call void @sink0(ptr %ptr0)
br label %bb9
bb7:
%ptr1 = inttoptr i64 %data to ptr
tail call void @sink1(ptr %ptr1)
br label %bb9
bb9:
ret void
}
; Negative test - all uses are casts, but non-identical ones.
define void @n1(i1 zeroext %c0, i1 zeroext %c1, ptr nocapture readonly %src) {
; CHECK-LABEL: @n1(
; CHECK-NEXT: bb:
; CHECK-NEXT: [[DATA:%.*]] = load i64, ptr [[SRC:%.*]], align 8
; CHECK-NEXT: br i1 [[C0:%.*]], label [[BB3:%.*]], label [[BB7:%.*]]
; CHECK: bb3:
; CHECK-NEXT: br i1 [[C1:%.*]], label [[BB4:%.*]], label [[BB5:%.*]]
; CHECK: bb4:
; CHECK-NEXT: tail call void @abort()
; CHECK-NEXT: unreachable
; CHECK: bb5:
; CHECK-NEXT: [[PTR0:%.*]] = inttoptr i64 [[DATA]] to ptr
; CHECK-NEXT: tail call void @sink0(ptr [[PTR0]])
; CHECK-NEXT: br label [[BB9:%.*]]
; CHECK: bb7:
; CHECK-NEXT: [[VEC:%.*]] = bitcast i64 [[DATA]] to <2 x i32>
; CHECK-NEXT: tail call void @sink2(<2 x i32> [[VEC]])
; CHECK-NEXT: br label [[BB9]]
; CHECK: bb9:
; CHECK-NEXT: ret void
;
bb:
%data = load i64, ptr %src, align 8
br i1 %c0, label %bb3, label %bb7
bb3:
br i1 %c1, label %bb4, label %bb5
bb4:
tail call void @abort()
unreachable
bb5:
%ptr0 = inttoptr i64 %data to ptr
tail call void @sink0(ptr %ptr0)
br label %bb9
bb7:
%vec = bitcast i64 %data to <2 x i32> ; different cast
tail call void @sink2(<2 x i32> %vec)
br label %bb9
bb9:
ret void
}
; Negative test - have non-cast users.
define void @n2(i1 zeroext %c0, i1 zeroext %c1, ptr nocapture readonly %src) {
; CHECK-LABEL: @n2(
; CHECK-NEXT: bb:
; CHECK-NEXT: [[DATA:%.*]] = load i64, ptr [[SRC:%.*]], align 8
; CHECK-NEXT: br i1 [[C0:%.*]], label [[BB3:%.*]], label [[BB7:%.*]]
; CHECK: bb3:
; CHECK-NEXT: br i1 [[C1:%.*]], label [[BB4:%.*]], label [[BB5:%.*]]
; CHECK: bb4:
; CHECK-NEXT: tail call void @abort()
; CHECK-NEXT: unreachable
; CHECK: bb5:
; CHECK-NEXT: [[PTR0:%.*]] = inttoptr i64 [[DATA]] to ptr
; CHECK-NEXT: tail call void @sink0(ptr [[PTR0]])
; CHECK-NEXT: br label [[BB9:%.*]]
; CHECK: bb7:
; CHECK-NEXT: tail call void @sink3(i64 [[DATA]])
; CHECK-NEXT: br label [[BB9]]
; CHECK: bb9:
; CHECK-NEXT: ret void
;
bb:
%data = load i64, ptr %src, align 8
br i1 %c0, label %bb3, label %bb7
bb3:
br i1 %c1, label %bb4, label %bb5
bb4:
tail call void @abort()
unreachable
bb5:
%ptr0 = inttoptr i64 %data to ptr
tail call void @sink0(ptr %ptr0)
br label %bb9
bb7:
tail call void @sink3(i64 %data) ; non-cast use
br label %bb9
bb9:
ret void
}
declare void @abort()
declare void @sink0(ptr)
declare void @sink1(ptr)
declare void @sink2(<2 x i32>)
declare void @sink3(i64)