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
120 lines
3.8 KiB
LLVM
120 lines
3.8 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
|
|
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
|
|
|
|
define ptr @mul4(ptr %p, i64 %x) {
|
|
; CHECK-LABEL: define ptr @mul4(
|
|
; CHECK-SAME: ptr [[P:%.*]], i64 [[X:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[GEP_IDX:%.*]] = shl i64 [[X]], 4
|
|
; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 [[GEP_IDX]]
|
|
; CHECK-NEXT: ret ptr [[GEP]]
|
|
;
|
|
entry:
|
|
%mul = mul i64 %x, 4
|
|
%gep = getelementptr inbounds i32, ptr %p, i64 %mul
|
|
ret ptr %gep
|
|
}
|
|
|
|
define ptr @mul4_nuw(ptr %p, i64 %x) {
|
|
; CHECK-LABEL: define ptr @mul4_nuw(
|
|
; CHECK-SAME: ptr [[P:%.*]], i64 [[X:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[GEP_IDX:%.*]] = shl i64 [[X]], 4
|
|
; CHECK-NEXT: [[GEP:%.*]] = getelementptr nuw i8, ptr [[P]], i64 [[GEP_IDX]]
|
|
; CHECK-NEXT: ret ptr [[GEP]]
|
|
;
|
|
entry:
|
|
%mul = mul i64 %x, 4
|
|
%gep = getelementptr nuw i32, ptr %p, i64 %mul
|
|
ret ptr %gep
|
|
}
|
|
|
|
define ptr @mul5(ptr %p, i64 %x) {
|
|
; CHECK-LABEL: define ptr @mul5(
|
|
; CHECK-SAME: ptr [[P:%.*]], i64 [[X:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[GEP_IDX:%.*]] = mul i64 [[X]], 20
|
|
; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 [[GEP_IDX]]
|
|
; CHECK-NEXT: ret ptr [[GEP]]
|
|
;
|
|
entry:
|
|
%mul = mul i64 %x, 5
|
|
%gep = getelementptr inbounds i32, ptr %p, i64 %mul
|
|
ret ptr %gep
|
|
}
|
|
|
|
define ptr @noinbounds(ptr %p, i64 %x) {
|
|
; CHECK-LABEL: define ptr @noinbounds(
|
|
; CHECK-SAME: ptr [[P:%.*]], i64 [[X:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[GEP_IDX:%.*]] = mul i64 [[X]], 20
|
|
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, ptr [[P]], i64 [[GEP_IDX]]
|
|
; CHECK-NEXT: ret ptr [[GEP]]
|
|
;
|
|
entry:
|
|
%mul = mul i64 %x, 5
|
|
%gep = getelementptr i32, ptr %p, i64 %mul
|
|
ret ptr %gep
|
|
}
|
|
|
|
define ptr @usemul(ptr %p, i64 %x) {
|
|
; CHECK-LABEL: define ptr @usemul(
|
|
; CHECK-SAME: ptr [[P:%.*]], i64 [[X:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[MUL:%.*]] = mul i64 [[X]], 5
|
|
; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds [4 x i8], ptr [[P]], i64 [[MUL]]
|
|
; CHECK-NEXT: call void @use(i64 [[MUL]])
|
|
; CHECK-NEXT: ret ptr [[GEP]]
|
|
;
|
|
entry:
|
|
%mul = mul i64 %x, 5
|
|
%gep = getelementptr inbounds i32, ptr %p, i64 %mul
|
|
call void @use(i64 %mul)
|
|
ret ptr %gep
|
|
}
|
|
|
|
define void @multiple(ptr %p, i64 %x) {
|
|
; CHECK-LABEL: define void @multiple(
|
|
; CHECK-SAME: ptr [[P:%.*]], i64 [[X:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[MUL21:%.*]] = mul i64 [[X]], 20
|
|
; CHECK-NEXT: [[GEP3:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 [[MUL21]]
|
|
; CHECK-NEXT: [[MUL20:%.*]] = mul i64 [[X]], 20
|
|
; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 [[MUL20]]
|
|
; CHECK-NEXT: call void @use2(ptr [[GEP3]], ptr [[GEP2]])
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
entry:
|
|
%mul5 = mul i64 %x, 5
|
|
%gep1 = getelementptr inbounds i32, ptr %p, i64 %mul5
|
|
%mul20 = mul i64 %x, 20
|
|
%gep2 = getelementptr inbounds i8, ptr %p, i64 %mul20
|
|
call void @use2(ptr %gep1, ptr %gep2)
|
|
ret void
|
|
}
|
|
|
|
define void @multiplestore(ptr %p, i64 %x) {
|
|
; CHECK-LABEL: define void @multiplestore(
|
|
; CHECK-SAME: ptr [[P:%.*]], i64 [[X:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[MUL20:%.*]] = mul i64 [[X]], 20
|
|
; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 [[MUL20]]
|
|
; CHECK-NEXT: [[MUL21:%.*]] = mul i64 [[X]], 20
|
|
; CHECK-NEXT: [[GEP3:%.*]] = getelementptr inbounds i8, ptr [[P]], i64 [[MUL21]]
|
|
; CHECK-NEXT: store i32 0, ptr [[GEP2]], align 4
|
|
; CHECK-NEXT: store i32 1, ptr [[GEP3]], align 4
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
entry:
|
|
%mul5 = mul i64 %x, 5
|
|
%gep1 = getelementptr inbounds i32, ptr %p, i64 %mul5
|
|
%mul20 = mul i64 %x, 20
|
|
%gep2 = getelementptr inbounds i8, ptr %p, i64 %mul20
|
|
store i32 0, ptr %gep1
|
|
store i32 1, ptr %gep2
|
|
ret void
|
|
}
|
|
|
|
declare void @use(i64)
|
|
declare void @use2(ptr, ptr)
|