Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/InstCombine/mem-gep-zidx.ll
T
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

63 lines
2.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-i64:64-n32:64"
target triple = "powerpc64-unknown-linux-gnu"
@f.a = private unnamed_addr constant [1 x i32] [i32 12], align 4
@f.b = private unnamed_addr constant [1 x i32] [i32 55], align 4
@f.c = linkonce unnamed_addr alias [1 x i32], ptr @f.b
define signext i32 @test1(i32 signext %x) #0 {
; CHECK-LABEL: @test1(
; CHECK-NEXT: ret i32 12
;
%idxprom = sext i32 %x to i64
%arrayidx = getelementptr inbounds [1 x i32], ptr @f.a, i64 0, i64 %idxprom
%r = load i32, ptr %arrayidx, align 4
ret i32 %r
}
declare void @foo(ptr %p)
define void @test2(i32 signext %x, i64 %v) #0 {
; CHECK-LABEL: @test2(
; CHECK-NEXT: [[P:%.*]] = alloca i64, align 8
; CHECK-NEXT: store i64 [[V:%.*]], ptr [[P]], align 8
; CHECK-NEXT: call void @foo(ptr nonnull [[P]]) #[[ATTR1:[0-9]+]]
; CHECK-NEXT: ret void
;
%p = alloca i64
%idxprom = sext i32 %x to i64
%arrayidx = getelementptr inbounds i64, ptr %p, i64 %idxprom
store i64 %v, ptr %arrayidx
call void @foo(ptr %p)
ret void
}
define signext i32 @test3(i32 signext %x, i1 %y) #0 {
; CHECK-LABEL: @test3(
; CHECK-NEXT: [[R:%.*]] = select i1 [[Y:%.*]], i32 12, i32 55
; CHECK-NEXT: ret i32 [[R]]
;
%idxprom = sext i32 %x to i64
%p = select i1 %y, ptr @f.a, ptr @f.b
%arrayidx = getelementptr inbounds [1 x i32], ptr %p, i64 0, i64 %idxprom
%r = load i32, ptr %arrayidx, align 4
ret i32 %r
}
define signext i32 @test4(i32 signext %x, i1 %y) #0 {
; CHECK-LABEL: @test4(
; CHECK-NEXT: [[IDXPROM:%.*]] = sext i32 [[X:%.*]] to i64
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [4 x i8], ptr @f.c, i64 [[IDXPROM]]
; CHECK-NEXT: [[R:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
; CHECK-NEXT: ret i32 [[R]]
;
%idxprom = sext i32 %x to i64
%arrayidx = getelementptr inbounds [1 x i32], ptr @f.c, i64 0, i64 %idxprom
%r = load i32, ptr %arrayidx, align 4
ret i32 %r
}
attributes #0 = { nounwind readnone }