Files
TheRock/compiler/amd-llvm/llvm/test/Analysis/DependenceAnalysis/rdiv-minor-algebra.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

79 lines
2.3 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
; RUN: opt < %s -disable-output "-passes=print<da>" 2>&1 \
; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-ALL
;
; for (i = 0; i < 2; i++) {
; A[-2] = 0;
; for (j = 0; j < 2; j++) {
; if (i == j)
; A[INT64_MAX*i + INT64_MAX*j] = 1;
; }
; }
;
; There is a dependency between the two stores.
;
; memory access | (i, j) == (1, 1)
; ------------------------------|------------------
; A[-2] | A[-2]
; A[INT64_MAX*i + INT64_MAX*j] | A[-2]
;
; Previously, this dependency was missed because RDIV performs "minor algebra"
; and transforms the subscripts as follows:
;
; A[-2] and A[INT64_MAX*i + INT64_MAX*j]
;
; | minor algebra
; v
;
; A[-INT64_MAX*j - 2] and A[INT64_MAX*i]
;
; This is unsound.
;
define void @f(ptr %A) {
; CHECK-LABEL: 'f'
; CHECK-NEXT: Src: store i8 0, ptr %gep.0, align 1 --> Dst: store i8 0, ptr %gep.0, align 1
; CHECK-NEXT: da analyze - output [S]!
; CHECK-NEXT: Src: store i8 0, ptr %gep.0, align 1 --> Dst: store i8 1, ptr %gep.1, align 1
; CHECK-NEXT: da analyze - output [*|<]!
; CHECK-NEXT: Src: store i8 1, ptr %gep.1, align 1 --> Dst: store i8 1, ptr %gep.1, align 1
; CHECK-NEXT: da analyze - output [* *]!
;
entry:
br label %loop.i.header
loop.i.header:
%i = phi i64 [ 0, %entry ], [ %i.inc, %loop.i.latch ]
%i.mul = mul i64 %i, 9223372036854775807
%gep.0 = getelementptr i8, ptr %A, i64 -2
store i8 0, ptr %gep.0
br label %loop.j.header
loop.j.header:
%j = phi i64 [ 0, %loop.i.header ], [ %j.inc, %loop.j.latch ]
%j.mul = mul i64 %j, 9223372036854775807
%offset.tmp = add i64 %i.mul, %j.mul
%offset = add i64 %offset.tmp, -2
%cond = icmp eq i64 %i, %j
br i1 %cond, label %if.then, label %loop.j.latch
if.then:
%gep.1 = getelementptr i8, ptr %A, i64 %offset
store i8 1, ptr %gep.1
br label %loop.j.latch
loop.j.latch:
%j.inc = add i64 %j, 1
%ec.j = icmp eq i64 %j.inc, 2
br i1 %ec.j, label %loop.i.latch, label %loop.j.header
loop.i.latch:
%i.inc = add i64 %i, 1
%ec.i = icmp eq i64 %i.inc, 2
br i1 %ec.i, label %exit, label %loop.i.header
exit:
ret void
}
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CHECK-ALL: {{.*}}