Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/GVN/PRE/pre-after-rle.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

119 lines
4.6 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -passes='require<phi-values>,gvn' -S < %s | FileCheck %s --check-prefixes=CHECK,CHECK-MEMDEP
; RUN: opt -passes='require<phi-values>,gvn<memoryssa>' -S < %s | FileCheck %s --check-prefixes=CHECK,CHECK-MEMSSA
declare noalias ptr @malloc(i64)
; Detecting that %s is fully redundant should let us detect that %w is partially
; redundant.
define void @fn1(ptr noalias %start, ptr %width, i32 %h) {
; CHECK-LABEL: define void @fn1(
; CHECK-SAME: ptr noalias [[START:%.*]], ptr [[WIDTH:%.*]], i32 [[H:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[CALL:%.*]] = tail call noalias ptr @malloc(i64 1024)
; CHECK-NEXT: store ptr [[CALL]], ptr [[START]], align 8
; CHECK-NEXT: br label %[[PREHEADER:.*]]
; CHECK: [[PREHEADER]]:
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 1, [[H]]
; CHECK-NEXT: br i1 [[CMP]], label %[[PREHEADER_BODY_CRIT_EDGE:.*]], label %[[EXIT:.*]]
; CHECK: [[PREHEADER_BODY_CRIT_EDGE]]:
; CHECK-NEXT: [[W_PRE:%.*]] = load i32, ptr [[WIDTH]], align 8
; CHECK-NEXT: br label %[[BODY:.*]]
; CHECK: [[BODY]]:
; CHECK-NEXT: [[J:%.*]] = phi i32 [ 0, %[[PREHEADER_BODY_CRIT_EDGE]] ], [ [[J_NEXT:%.*]], %[[BODY]] ]
; CHECK-NEXT: store i32 0, ptr [[CALL]], align 4
; CHECK-NEXT: [[J_NEXT]] = add nuw nsw i32 [[J]], 1
; CHECK-NEXT: [[CMP3:%.*]] = icmp slt i32 [[J_NEXT]], [[W_PRE]]
; CHECK-NEXT: br i1 [[CMP3]], label %[[BODY]], label %[[PREHEADER]]
; CHECK: [[EXIT]]:
; CHECK-NEXT: ret void
;
entry:
%call = tail call noalias ptr @malloc(i64 1024)
store ptr %call, ptr %start, align 8
br label %preheader
preheader:
%cmp = icmp slt i32 1, %h
br i1 %cmp, label %body, label %exit
body:
%j = phi i32 [ 0, %preheader ], [ %j.next, %body ]
%s = load ptr, ptr %start, align 8
store i32 0, ptr %s, align 4
%j.next = add nuw nsw i32 %j, 1
%w = load i32, ptr %width, align 8
%cmp3 = icmp slt i32 %j.next, %w
br i1 %cmp3, label %body, label %preheader
exit:
ret void
}
; %s is fully redundant but has more than one available value. Detecting that
; %w is partially redundant requires alias analysis that can analyze those
; values.
define void @fn2(ptr noalias %start, ptr %width, i32 %h, i32 %arg) {
; CHECK-LABEL: define void @fn2(
; CHECK-SAME: ptr noalias [[START:%.*]], ptr [[WIDTH:%.*]], i32 [[H:%.*]], i32 [[ARG:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[CALL:%.*]] = tail call noalias ptr @malloc(i64 1024)
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[ARG]], 0
; CHECK-NEXT: br i1 [[CMP1]], label %[[IF:.*]], label %[[ELSE:.*]]
; CHECK: [[IF]]:
; CHECK-NEXT: store ptr [[CALL]], ptr [[START]], align 8
; CHECK-NEXT: br label %[[PREHEADER:.*]]
; CHECK: [[ELSE]]:
; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i32, ptr [[CALL]], i32 [[ARG]]
; CHECK-NEXT: store ptr [[GEP]], ptr [[START]], align 8
; CHECK-NEXT: br label %[[PREHEADER]]
; CHECK: [[PREHEADER]]:
; CHECK-NEXT: [[S:%.*]] = phi ptr [ [[S]], %[[BODY:.*]] ], [ [[GEP]], %[[ELSE]] ], [ [[CALL]], %[[IF]] ]
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 1, [[H]]
; CHECK-NEXT: br i1 [[CMP]], label %[[PREHEADER_BODY_CRIT_EDGE:.*]], label %[[EXIT:.*]]
; CHECK: [[PREHEADER_BODY_CRIT_EDGE]]:
; CHECK-NEXT: [[W_PRE:%.*]] = load i32, ptr [[WIDTH]], align 8
; CHECK-NEXT: br label %[[BODY]]
; CHECK: [[BODY]]:
; CHECK-NEXT: [[J:%.*]] = phi i32 [ 0, %[[PREHEADER_BODY_CRIT_EDGE]] ], [ [[J_NEXT:%.*]], %[[BODY]] ]
; CHECK-NEXT: store i32 0, ptr [[S]], align 4
; CHECK-NEXT: [[J_NEXT]] = add nuw nsw i32 [[J]], 1
; CHECK-NEXT: [[CMP3:%.*]] = icmp slt i32 [[J_NEXT]], [[W_PRE]]
; CHECK-NEXT: br i1 [[CMP3]], label %[[BODY]], label %[[PREHEADER]]
; CHECK: [[EXIT]]:
; CHECK-NEXT: ret void
;
entry:
%call = tail call noalias ptr @malloc(i64 1024)
%cmp1 = icmp slt i32 %arg, 0
br i1 %cmp1, label %if, label %else
if:
store ptr %call, ptr %start, align 8
br label %preheader
else:
%gep = getelementptr inbounds i32, ptr %call, i32 %arg
store ptr %gep, ptr %start, align 8
br label %preheader
preheader:
%cmp = icmp slt i32 1, %h
br i1 %cmp, label %body, label %exit
body:
%j = phi i32 [ 0, %preheader ], [ %j.next, %body ]
%s = load ptr, ptr %start, align 8
store i32 0, ptr %s, align 4
%j.next = add nuw nsw i32 %j, 1
%w = load i32, ptr %width, align 8
%cmp3 = icmp slt i32 %j.next, %w
br i1 %cmp3, label %body, label %preheader
exit:
ret void
}
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CHECK-MEMDEP: {{.*}}
; CHECK-MEMSSA: {{.*}}