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

138 lines
4.0 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=aggressive-instcombine -S | FileCheck %s
define i1 @remove_shift_nuw_ab(i8 %a, i8 %b, i8 %s) {
; CHECK-LABEL: @remove_shift_nuw_ab(
; CHECK-NEXT: [[OR:%.*]] = or i8 [[T:%.*]], [[B:%.*]]
; CHECK-NEXT: [[IC:%.*]] = icmp eq i8 [[OR]], 0
; CHECK-NEXT: ret i1 [[IC]]
;
%t = shl nuw i8 %a, %s
%or = or i8 %t, %b
%ic = icmp eq i8 %or, 0
ret i1 %ic
}
define i1 @remove_shift_nuw_ba(i8 %a, i8 %b, i8 %s) {
; CHECK-LABEL: @remove_shift_nuw_ba(
; CHECK-NEXT: [[OR:%.*]] = or i8 [[B:%.*]], [[T:%.*]]
; CHECK-NEXT: [[IC:%.*]] = icmp eq i8 [[OR]], 0
; CHECK-NEXT: ret i1 [[IC]]
;
%t = shl nuw i8 %a, %s
%or = or i8 %b, %t
%ic = icmp eq i8 %or, 0
ret i1 %ic
}
define i1 @remove_shift_nsw(i8 %a, i8 %b, i8 %s) {
; CHECK-LABEL: @remove_shift_nsw(
; CHECK-NEXT: [[OR:%.*]] = or i8 [[T:%.*]], [[B:%.*]]
; CHECK-NEXT: [[IC:%.*]] = icmp eq i8 [[OR]], 0
; CHECK-NEXT: ret i1 [[IC]]
;
%t = shl nsw i8 %a, %s
%or = or i8 %t, %b
%ic = icmp eq i8 %or, 0
ret i1 %ic
}
define i1 @remove_shift_nuw_ne(i8 %a, i8 %b, i8 %s) {
; CHECK-LABEL: @remove_shift_nuw_ne(
; CHECK-NEXT: [[OR:%.*]] = or i8 [[T:%.*]], [[B:%.*]]
; CHECK-NEXT: [[IC:%.*]] = icmp eq i8 [[OR]], 0
; CHECK-NEXT: ret i1 [[IC]]
;
%t = shl nuw i8 %a, %s
%or = or i8 %t, %b
%ic = icmp eq i8 %or, 0
ret i1 %ic
}
define i1 @remove_shift_nsw_ne(i8 %a, i8 %b, i8 %s) {
; CHECK-LABEL: @remove_shift_nsw_ne(
; CHECK-NEXT: [[OR:%.*]] = or i8 [[T:%.*]], [[B:%.*]]
; CHECK-NEXT: [[IC:%.*]] = icmp eq i8 [[OR]], 0
; CHECK-NEXT: ret i1 [[IC]]
;
%t = shl nsw i8 %a, %s
%or = or i8 %t, %b
%ic = icmp eq i8 %or, 0
ret i1 %ic
}
define i1 @remove_shift_wraps(i8 %a, i8 %b, i8 %s) {
; CHECK-LABEL: @remove_shift_wraps(
; CHECK-NEXT: [[T:%.*]] = shl i8 [[A:%.*]], [[S:%.*]]
; CHECK-NEXT: [[OR:%.*]] = or i8 [[T]], [[B:%.*]]
; CHECK-NEXT: [[IC:%.*]] = icmp eq i8 [[OR]], 0
; CHECK-NEXT: ret i1 [[IC]]
;
%t = shl i8 %a, %s
%or = or i8 %t, %b
%ic = icmp eq i8 %or, 0
ret i1 %ic
}
define i1 @remove_shift_chain_d(i8 %a, i8 %b, i8 %c, i8 %d, i8 %s) {
; CHECK-LABEL: @remove_shift_chain_d(
; CHECK-NEXT: [[OR1:%.*]] = or i8 [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: [[OR2:%.*]] = or i8 [[C:%.*]], [[DT:%.*]]
; CHECK-NEXT: [[OR:%.*]] = or i8 [[OR1]], [[OR2]]
; CHECK-NEXT: [[IC:%.*]] = icmp eq i8 [[OR]], 0
; CHECK-NEXT: ret i1 [[IC]]
;
%dt = shl nuw i8 %d, %s
%or1 = or i8 %a, %b
%or2 = or i8 %c, %dt
%or = or i8 %or1, %or2
%ic = icmp eq i8 %or, 0
ret i1 %ic
}
define i1 @remove_shift_chain_abcd(i8 %a, i8 %b, i8 %c, i8 %d, i8 %s) {
; CHECK-LABEL: @remove_shift_chain_abcd(
; CHECK-NEXT: [[OR1:%.*]] = or i8 [[AT:%.*]], [[BT:%.*]]
; CHECK-NEXT: [[OR2:%.*]] = or i8 [[CT:%.*]], [[DT:%.*]]
; CHECK-NEXT: [[OR:%.*]] = or i8 [[OR1]], [[OR2]]
; CHECK-NEXT: [[IC:%.*]] = icmp eq i8 [[OR]], 0
; CHECK-NEXT: ret i1 [[IC]]
;
%at = shl nuw i8 %a, %s
%bt = shl nuw i8 %b, 2
%ct = shl nuw i8 %c, 1
%dt = shl nuw i8 %d, %s
%or1 = or i8 %at, %bt
%or2 = or i8 %ct, %dt
%or = or i8 %or1, %or2
%ic = icmp eq i8 %or, 0
ret i1 %ic
}
define i1 @remove_shift_chain_abcd_multiuse(i8 %a, i8 %b, i8 %c, i8 %d, i8 %s) {
; CHECK-LABEL: @remove_shift_chain_abcd_multiuse(
; CHECK-NEXT: [[AT:%.*]] = shl nuw i8 [[A:%.*]], [[S:%.*]]
; CHECK-NEXT: [[BT:%.*]] = shl nuw i8 [[B:%.*]], 2
; CHECK-NEXT: [[CT:%.*]] = shl nuw i8 [[C:%.*]], 1
; CHECK-NEXT: [[DT:%.*]] = shl nuw i8 [[D:%.*]], [[S]]
; CHECK-NEXT: [[OR1:%.*]] = or i8 [[AT]], [[BT]]
; CHECK-NEXT: [[OR2:%.*]] = or i8 [[CT]], [[DT]]
; CHECK-NEXT: [[OR:%.*]] = or i8 [[OR1]], [[OR2]]
; CHECK-NEXT: [[IC:%.*]] = icmp eq i8 [[OR]], 0
; CHECK-NEXT: call void @use(i8 [[OR]])
; CHECK-NEXT: ret i1 [[IC]]
;
%at = shl nuw i8 %a, %s
%bt = shl nuw i8 %b, 2
%ct = shl nuw i8 %c, 1
%dt = shl nuw i8 %d, %s
%or1 = or i8 %at, %bt
%or2 = or i8 %ct, %dt
%or = or i8 %or1, %or2
%ic = icmp eq i8 %or, 0
call void @use(i8 %or)
ret i1 %ic
}
declare void @use(i8)