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
2.9 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' -mtriple=x86_64-unknown-unknown < %s | FileCheck %s
; Make sure the nsw flag is dropped when the load ext is combined.
define i32 @simplify_load_ext_drop_trunc_nsw(ptr %p) {
; CHECK-LABEL: define i32 @simplify_load_ext_drop_trunc_nsw(
; CHECK-SAME: ptr [[P:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P]], align 4
; CHECK-NEXT: [[TMP0:%.*]] = and i32 [[X]], 255
; CHECK-NEXT: [[TRUNC:%.*]] = trunc i32 [[TMP0]] to i8
; CHECK-NEXT: [[EXT1:%.*]] = sext i8 [[TRUNC]] to i16
; CHECK-NEXT: call void @use(i32 [[TMP0]])
; CHECK-NEXT: [[EXT2:%.*]] = zext i16 [[EXT1]] to i32
; CHECK-NEXT: ret i32 [[EXT2]]
;
entry:
%x = load i32, ptr %p, align 4
%trunc = trunc nsw i32 %x to i8
%ext1 = sext i8 %trunc to i16
%conv2 = and i32 %x, 255
call void @use(i32 %conv2)
%ext2 = zext i16 %ext1 to i32
ret i32 %ext2
}
; Make sure the nsw flag is dropped when the load ext is combined.
define i32 @simplify_load_ext_drop_shl_nsw(ptr %p) {
; CHECK-LABEL: define i32 @simplify_load_ext_drop_shl_nsw(
; CHECK-SAME: ptr [[P:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P]], align 4
; CHECK-NEXT: [[TMP0:%.*]] = and i32 [[X]], 255
; CHECK-NEXT: [[SHL:%.*]] = shl i32 [[TMP0]], 24
; CHECK-NEXT: call void @use(i32 [[TMP0]])
; CHECK-NEXT: ret i32 [[SHL]]
;
entry:
%x = load i32, ptr %p, align 4
%shl = shl nsw i32 %x, 24
%conv2 = and i32 %x, 255
call void @use(i32 %conv2)
ret i32 %shl
}
define i32 @simplify_load_ext_keep_trunc_nuw(ptr %p) {
; CHECK-LABEL: define i32 @simplify_load_ext_keep_trunc_nuw(
; CHECK-SAME: ptr [[P:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P]], align 4
; CHECK-NEXT: [[TMP0:%.*]] = and i32 [[X]], 255
; CHECK-NEXT: [[TRUNC:%.*]] = trunc nuw i32 [[TMP0]] to i8
; CHECK-NEXT: [[EXT1:%.*]] = sext i8 [[TRUNC]] to i16
; CHECK-NEXT: call void @use(i32 [[TMP0]])
; CHECK-NEXT: [[EXT2:%.*]] = zext i16 [[EXT1]] to i32
; CHECK-NEXT: ret i32 [[EXT2]]
;
entry:
%x = load i32, ptr %p, align 4
%trunc = trunc nuw i32 %x to i8
%ext1 = sext i8 %trunc to i16
%conv2 = and i32 %x, 255
call void @use(i32 %conv2)
%ext2 = zext i16 %ext1 to i32
ret i32 %ext2
}
define i32 @simplify_load_ext_drop_shl_nuw(ptr %p) {
; CHECK-LABEL: define i32 @simplify_load_ext_drop_shl_nuw(
; CHECK-SAME: ptr [[P:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P]], align 4
; CHECK-NEXT: [[TMP0:%.*]] = and i32 [[X]], 255
; CHECK-NEXT: [[SHL:%.*]] = shl nuw i32 [[TMP0]], 24
; CHECK-NEXT: call void @use(i32 [[TMP0]])
; CHECK-NEXT: ret i32 [[SHL]]
;
entry:
%x = load i32, ptr %p, align 4
%shl = shl nuw i32 %x, 24
%conv2 = and i32 %x, 255
call void @use(i32 %conv2)
ret i32 %shl
}
declare void @use(i32)