[llvm] [LAA] Prepare to handle diff type sizes v2 (PR #161238)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 29 10:15:13 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Ramkumar Ramachandra (artagnon)
<details>
<summary>Changes</summary>
The change was originally landed as 1aded51 ([LAA] Prepare to handle diff type sizes (NFC)), but resulted in regressions, and a subsequent crash when 56a1cbb ([LAA] Fix non-NFC parts 1aded51) was landed. This iteration includes tests from reports, corresponding fixes, and is not a NFC. In particular, it fixes the case of loop-guards not being applied before checking isSafeDependenceDistance.
As depend_diff_types shows, there are several places where the HasSameSize check can be relaxed for higher analysis precision. As a first step, return both the source size and the sink size from getDependenceDistanceStrideAndSize, along with a HasSameSize boolean for the moment.
---
Patch is 35.77 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/161238.diff
7 Files Affected:
- (modified) llvm/include/llvm/Analysis/LoopAccessAnalysis.h (+14-13)
- (modified) llvm/lib/Analysis/LoopAccessAnalysis.cpp (+51-40)
- (modified) llvm/test/Analysis/LoopAccessAnalysis/depend_diff_types.ll (+39)
- (modified) llvm/test/Analysis/LoopAccessAnalysis/is-safe-dep-distance-with-loop-guards.ll (-46)
- (added) llvm/test/Analysis/LoopAccessAnalysis/unknown-dependence-with-loop-guards.ll (+160)
- (modified) llvm/test/Transforms/LoopVectorize/X86/interleaved-accesses-use-after-free.ll (-24)
- (modified) llvm/test/Transforms/LoopVectorize/reuse-lcssa-phi-scev-expansion.ll (+10-92)
``````````diff
diff --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
index 52ab38583d5de..49a795b5fd6a7 100644
--- a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -413,29 +413,30 @@ class MemoryDepChecker {
uint64_t MaxStride;
std::optional<uint64_t> CommonStride;
- /// TypeByteSize is either the common store size of both accesses, or 0 when
- /// store sizes mismatch.
- uint64_t TypeByteSize;
+ /// TypeByteSize is a pair of alloc sizes of the source and sink.
+ std::pair<uint64_t, uint64_t> TypeByteSize;
+
+ // HasSameSize is a boolean indicating whether the store sizes of the source
+ // and sink are equal.
+ // TODO: Remove this.
+ bool HasSameSize;
bool AIsWrite;
bool BIsWrite;
DepDistanceStrideAndSizeInfo(const SCEV *Dist, uint64_t MaxStride,
std::optional<uint64_t> CommonStride,
- uint64_t TypeByteSize, bool AIsWrite,
- bool BIsWrite)
+ std::pair<uint64_t, uint64_t> TypeByteSize,
+ bool HasSameSize, bool AIsWrite, bool BIsWrite)
: Dist(Dist), MaxStride(MaxStride), CommonStride(CommonStride),
- TypeByteSize(TypeByteSize), AIsWrite(AIsWrite), BIsWrite(BIsWrite) {}
+ TypeByteSize(TypeByteSize), HasSameSize(HasSameSize),
+ AIsWrite(AIsWrite), BIsWrite(BIsWrite) {}
};
/// Get the dependence distance, strides, type size and whether it is a write
- /// for the dependence between A and B. Returns a DepType, if we can prove
- /// there's no dependence or the analysis fails. Outlined to lambda to limit
- /// he scope of various temporary variables, like A/BPtr, StrideA/BPtr and
- /// others. Returns either the dependence result, if it could already be
- /// determined, or a DepDistanceStrideAndSizeInfo struct, noting that
- /// TypeByteSize could be 0 when store sizes mismatch, and this should be
- /// checked in the caller.
+ /// for the dependence between A and B. Returns either a DepType, the
+ /// dependence result, if it could already be determined, or a
+ /// DepDistanceStrideAndSizeInfo struct.
std::variant<Dependence::DepType, DepDistanceStrideAndSizeInfo>
getDependenceDistanceStrideAndSize(const MemAccessInfo &A, Instruction *AInst,
const MemAccessInfo &B,
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 87fae92977cd2..8a5f799793a14 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2090,14 +2090,12 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize(
return MemoryDepChecker::Dependence::Unknown;
}
- TypeSize AStoreSz = DL.getTypeStoreSize(ATy);
- TypeSize BStoreSz = DL.getTypeStoreSize(BTy);
-
- // If store sizes are not the same, set TypeByteSize to zero, so we can check
- // it in the caller isDependent.
uint64_t ASz = DL.getTypeAllocSize(ATy);
uint64_t BSz = DL.getTypeAllocSize(BTy);
- uint64_t TypeByteSize = (AStoreSz == BStoreSz) ? BSz : 0;
+
+ // Both the source and sink sizes are neeeded in dependence checks, depending
+ // on the use.
+ std::pair<uint64_t, uint64_t> TypeByteSize(ASz, BSz);
uint64_t StrideAScaled = std::abs(StrideAPtrInt) * ASz;
uint64_t StrideBScaled = std::abs(StrideBPtrInt) * BSz;
@@ -2108,19 +2106,41 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize(
if (StrideAScaled == StrideBScaled)
CommonStride = StrideAScaled;
- // TODO: Historically, we didn't retry with runtime checks when (unscaled)
- // strides were different but there is no inherent reason to.
- if (!isa<SCEVConstant>(Dist))
- ShouldRetryWithRuntimeChecks |= StrideAPtrInt == StrideBPtrInt;
-
// If distance is a SCEVCouldNotCompute, return Unknown immediately.
if (isa<SCEVCouldNotCompute>(Dist)) {
LLVM_DEBUG(dbgs() << "LAA: Uncomputable distance.\n");
return Dependence::Unknown;
}
+ if (!isa<SCEVConstant>(Dist)) {
+ if (!LoopGuards)
+ LoopGuards.emplace(
+ ScalarEvolution::LoopGuards::collect(InnermostLoop, SE));
+ Dist = SE.applyLoopGuards(Dist, *LoopGuards);
+
+ // TODO: Historically, we didn't retry with runtime checks when (unscaled)
+ // strides were different but there is no inherent reason to.
+ ShouldRetryWithRuntimeChecks |= StrideAPtrInt == StrideBPtrInt;
+ }
+
+ // When the distance is possibly zero, we're reading/writing the same memory
+ // location: if the store sizes are not equal, fail with an unknown
+ // dependence.
+ TypeSize AStoreSz = DL.getTypeStoreSize(ATy);
+ TypeSize BStoreSz = DL.getTypeStoreSize(BTy);
+ if (AStoreSz != BStoreSz && SE.isKnownNonPositive(Dist) &&
+ SE.isKnownNonNegative(Dist)) {
+ LLVM_DEBUG(dbgs() << "LAA: possibly zero dependence distance with "
+ "different type sizes\n");
+ return Dependence::Unknown;
+ }
+
+ // TODO: Remove this.
+ bool HasSameSize = AStoreSz == BStoreSz;
+
return DepDistanceStrideAndSizeInfo(Dist, MaxStride, CommonStride,
- TypeByteSize, AIsWrite, BIsWrite);
+ TypeByteSize, HasSameSize, AIsWrite,
+ BIsWrite);
}
MemoryDepChecker::Dependence::DepType
@@ -2152,9 +2172,8 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
return std::get<Dependence::DepType>(Res);
}
- auto &[Dist, MaxStride, CommonStride, TypeByteSize, AIsWrite, BIsWrite] =
- std::get<DepDistanceStrideAndSizeInfo>(Res);
- bool HasSameSize = TypeByteSize > 0;
+ auto &[Dist, MaxStride, CommonStride, TypeByteSize, HasSameSize, AIsWrite,
+ BIsWrite] = std::get<DepDistanceStrideAndSizeInfo>(Res);
ScalarEvolution &SE = *PSE.getSE();
auto &DL = InnermostLoop->getHeader()->getDataLayout();
@@ -2175,32 +2194,22 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
uint64_t ConstDist =
match(Dist, m_scev_APInt(APDist)) ? APDist->abs().getZExtValue() : 0;
- // Attempt to prove strided accesses independent.
- if (APDist) {
- // If the distance between accesses and their strides are known constants,
- // check whether the accesses interlace each other.
- if (ConstDist > 0 && CommonStride && CommonStride > 1 && HasSameSize &&
- areStridedAccessesIndependent(ConstDist, *CommonStride, TypeByteSize)) {
- LLVM_DEBUG(dbgs() << "LAA: Strided accesses are independent\n");
- return Dependence::NoDep;
- }
- } else {
- if (!LoopGuards)
- LoopGuards.emplace(
- ScalarEvolution::LoopGuards::collect(InnermostLoop, SE));
- Dist = SE.applyLoopGuards(Dist, *LoopGuards);
+ // Attempt to prove strided accesses independent. If the distance between
+ // accesses and their strides are known constants, check whether the accesses
+ // interlace each other.
+ if (ConstDist && CommonStride && CommonStride > 1 && HasSameSize &&
+ areStridedAccessesIndependent(ConstDist, *CommonStride,
+ TypeByteSize.first)) {
+ LLVM_DEBUG(dbgs() << "LAA: Strided accesses are independent\n");
+ return Dependence::NoDep;
}
// Negative distances are not plausible dependencies.
if (SE.isKnownNonPositive(Dist)) {
if (SE.isKnownNonNegative(Dist)) {
- if (HasSameSize) {
- // Write to the same location with the same size.
- return Dependence::Forward;
- }
- LLVM_DEBUG(dbgs() << "LAA: possibly zero dependence difference but "
- "different type sizes\n");
- return Dependence::Unknown;
+ // Write to the same location with the same size.
+ assert(HasSameSize && "Accesses must have the same size");
+ return Dependence::Forward;
}
bool IsTrueDataDependence = (AIsWrite && !BIsWrite);
@@ -2218,7 +2227,7 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
: Dependence::Unknown;
}
if (!HasSameSize ||
- couldPreventStoreLoadForward(ConstDist, TypeByteSize)) {
+ couldPreventStoreLoadForward(ConstDist, TypeByteSize.first)) {
LLVM_DEBUG(
dbgs() << "LAA: Forward but may prevent st->ld forwarding\n");
return Dependence::ForwardButPreventsForwarding;
@@ -2284,7 +2293,8 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
// We know that Dist is positive, but it may not be constant. Use the signed
// minimum for computations below, as this ensures we compute the closest
// possible dependence distance.
- uint64_t MinDistanceNeeded = MaxStride * (MinNumIter - 1) + TypeByteSize;
+ uint64_t MinDistanceNeeded =
+ MaxStride * (MinNumIter - 1) + TypeByteSize.first;
if (MinDistanceNeeded > static_cast<uint64_t>(MinDistance)) {
if (!ConstDist) {
// For non-constant distances, we checked the lower bound of the
@@ -2312,14 +2322,15 @@ MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx,
bool IsTrueDataDependence = (!AIsWrite && BIsWrite);
if (IsTrueDataDependence && EnableForwardingConflictDetection && ConstDist &&
- couldPreventStoreLoadForward(MinDistance, TypeByteSize, *CommonStride))
+ couldPreventStoreLoadForward(MinDistance, TypeByteSize.first,
+ *CommonStride))
return Dependence::BackwardVectorizableButPreventsForwarding;
uint64_t MaxVF = MinDepDistBytes / MaxStride;
LLVM_DEBUG(dbgs() << "LAA: Positive min distance " << MinDistance
<< " with max VF = " << MaxVF << '\n');
- uint64_t MaxVFInBits = MaxVF * TypeByteSize * 8;
+ uint64_t MaxVFInBits = MaxVF * TypeByteSize.first * 8;
if (!ConstDist && MaxVFInBits < MaxTargetVectorWidthInBits) {
// For non-constant distances, we checked the lower bound of the dependence
// distance and the distance may be larger at runtime (and safe for
diff --git a/llvm/test/Analysis/LoopAccessAnalysis/depend_diff_types.ll b/llvm/test/Analysis/LoopAccessAnalysis/depend_diff_types.ll
index 023a8c056968f..c367b31f6d445 100644
--- a/llvm/test/Analysis/LoopAccessAnalysis/depend_diff_types.ll
+++ b/llvm/test/Analysis/LoopAccessAnalysis/depend_diff_types.ll
@@ -187,6 +187,45 @@ exit:
ret void
}
+; In the following test, dependence distance is possibly zero,
+; but this is not equivalent to the condition known-non-positive
+; and known-non-negative.
+
+define void @possibly_zero_dist_diff_typesz(ptr %p) {
+; CHECK-LABEL: 'possibly_zero_dist_diff_typesz'
+; CHECK-NEXT: loop:
+; CHECK-NEXT: Memory dependences are safe
+; CHECK-NEXT: Dependences:
+; CHECK-NEXT: Forward:
+; CHECK-NEXT: %ld.p = load i32, ptr %gep.p.iv.i32, align 1 ->
+; CHECK-NEXT: store i16 %trunc, ptr %gep.p.iv.i16, align 1
+; CHECK-EMPTY:
+; CHECK-NEXT: Run-time memory checks:
+; CHECK-NEXT: Grouped accesses:
+; CHECK-EMPTY:
+; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
+; CHECK-NEXT: SCEV assumptions:
+; CHECK-EMPTY:
+; CHECK-NEXT: Expressions re-written:
+;
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i16 [ 0, %entry ], [ %iv.next, %loop ]
+ %gep.p.iv.i32 = getelementptr inbounds nuw i32, ptr %p, i16 %iv
+ %ld.p = load i32, ptr %gep.p.iv.i32, align 1
+ %trunc = trunc i32 %ld.p to i16
+ %gep.p.iv.i16 = getelementptr inbounds nuw i16, ptr %p, i16 %iv
+ store i16 %trunc, ptr %gep.p.iv.i16, align 1
+ %iv.next = add nuw nsw i16 %iv, 1
+ %exit.cond = icmp eq i16 %iv.next, 32
+ br i1 %exit.cond, label %exit, label %loop
+
+exit:
+ ret void
+}
+
; In the following test, the sink is loop-invariant.
define void @type_size_equivalence_sink_loopinv(ptr nocapture %vec, i64 %n) {
diff --git a/llvm/test/Analysis/LoopAccessAnalysis/is-safe-dep-distance-with-loop-guards.ll b/llvm/test/Analysis/LoopAccessAnalysis/is-safe-dep-distance-with-loop-guards.ll
index 9cc0a976c900e..9b23ed6e6eca0 100644
--- a/llvm/test/Analysis/LoopAccessAnalysis/is-safe-dep-distance-with-loop-guards.ll
+++ b/llvm/test/Analysis/LoopAccessAnalysis/is-safe-dep-distance-with-loop-guards.ll
@@ -37,49 +37,3 @@ loop:
exit:
ret void
}
-
-define void @safe_deps_2_due_to_dependence_distance(i16 %n, ptr %p3, i16 noundef %q, ptr %p1, ptr %p2) {
-; CHECK-LABEL: 'safe_deps_2_due_to_dependence_distance'
-; CHECK-NEXT: loop:
-; CHECK-NEXT: Memory dependences are safe
-; CHECK-NEXT: Dependences:
-; CHECK-NEXT: Run-time memory checks:
-; CHECK-NEXT: Grouped accesses:
-; CHECK-EMPTY:
-; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
-; CHECK-NEXT: SCEV assumptions:
-; CHECK-EMPTY:
-; CHECK-NEXT: Expressions re-written:
-;
-entry:
- %0 = shl i16 %n, 1
- %alloca = alloca [2 x i32], i16 %0
- %arrayidx1 = getelementptr inbounds i32, ptr %p1, i16 %q
- %arrayidx2 = getelementptr inbounds i8, ptr %p3, i16 2
- %arrayidx4 = getelementptr inbounds i32, ptr %p2, i16 %q
- %cmp42 = icmp sgt i16 %n, 0
- br i1 %cmp42, label %ph, label %exit
-
-ph:
- %arrayidx40 = getelementptr inbounds [2 x i32], ptr %alloca, i16 %n
- br label %loop
-
-loop:
- %iv = phi i16 [ 0, %ph ], [ %iv.next, %loop ]
- %arrayidx6 = getelementptr inbounds i32, ptr %arrayidx1, i16 %iv
- %arrayidx11 = getelementptr inbounds i32, ptr %arrayidx4, i16 %iv
- %arrayidx22 = getelementptr inbounds [2 x i32], ptr %alloca, i16 %iv
- store i32 10, ptr %arrayidx22
- %arrayidx33 = getelementptr inbounds i8, ptr %arrayidx22, i16 4
- store i32 16, ptr %arrayidx33
- %arrayidx42 = getelementptr inbounds [2 x i32], ptr %arrayidx40, i16 %iv
- store i32 19, ptr %arrayidx42
- %arrayidx53 = getelementptr inbounds i8, ptr %arrayidx42, i16 4
- store i32 23, ptr %arrayidx53
- %iv.next = add nuw nsw i16 %iv, 1
- %exitcond.not = icmp eq i16 %iv.next, %n
- br i1 %exitcond.not, label %exit, label %loop
-
-exit:
- ret void
-}
diff --git a/llvm/test/Analysis/LoopAccessAnalysis/unknown-dependence-with-loop-guards.ll b/llvm/test/Analysis/LoopAccessAnalysis/unknown-dependence-with-loop-guards.ll
new file mode 100644
index 0000000000000..4d4ecb3b28aeb
--- /dev/null
+++ b/llvm/test/Analysis/LoopAccessAnalysis/unknown-dependence-with-loop-guards.ll
@@ -0,0 +1,160 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -passes='print<access-info>' -disable-output %s 2>&1 | FileCheck %s
+
+define void @unsafe_dep_loopguards(ptr %a, ptr %b, ptr %c) {
+; CHECK-LABEL: 'unsafe_dep_loopguards'
+; CHECK-NEXT: loop:
+; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
+; CHECK-NEXT: Unknown data dependence.
+; CHECK-NEXT: Dependences:
+; CHECK-NEXT: Unknown:
+; CHECK-NEXT: %ld.a = load [4 x i32], ptr %gep.a.offset.2, align 4 ->
+; CHECK-NEXT: store i32 0, ptr %gep.a.offset.4, align 4
+; CHECK-EMPTY:
+; CHECK-NEXT: Run-time memory checks:
+; CHECK-NEXT: Check 0:
+; CHECK-NEXT: Comparing group GRP0:
+; CHECK-NEXT: ptr %c
+; CHECK-NEXT: Against group GRP1:
+; CHECK-NEXT: %gep.a.offset.2 = getelementptr i32, ptr %gep.a.offset, i32 4
+; CHECK-NEXT: Check 1:
+; CHECK-NEXT: Comparing group GRP0:
+; CHECK-NEXT: ptr %c
+; CHECK-NEXT: Against group GRP2:
+; CHECK-NEXT: %gep.a.offset.4 = getelementptr i32, ptr %a, i32 %offset.4
+; CHECK-NEXT: Grouped accesses:
+; CHECK-NEXT: Group GRP0:
+; CHECK-NEXT: (Low: %c High: (16 + %c))
+; CHECK-NEXT: Member: %c
+; CHECK-NEXT: Group GRP1:
+; CHECK-NEXT: (Low: (16 + (4 * (sext i32 %ld.b to i64))<nsw> + %a) High: (64 + (4 * (sext i32 %ld.b to i64))<nsw> + %a))
+; CHECK-NEXT: Member: {(16 + (4 * (sext i32 %ld.b to i64))<nsw> + %a),+,32}<%loop>
+; CHECK-NEXT: Group GRP2:
+; CHECK-NEXT: (Low: ((4 * (sext i32 (4 + %ld.b) to i64))<nsw> + %a) High: (36 + (4 * (sext i32 (4 + %ld.b) to i64))<nsw> + %a))
+; CHECK-NEXT: Member: {((4 * (sext i32 (4 + %ld.b) to i64))<nsw> + %a),+,32}<%loop>
+; CHECK-EMPTY:
+; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
+; CHECK-NEXT: SCEV assumptions:
+; CHECK-NEXT: {(4 + %ld.b),+,8}<nw><%loop> Added Flags: <nssw>
+; CHECK-NEXT: {((4 * (sext i32 (4 + %ld.b) to i64))<nsw> + %a),+,32}<%loop> Added Flags: <nusw>
+; CHECK-NEXT: {%ld.b,+,8}<nw><%loop> Added Flags: <nssw>
+; CHECK-NEXT: {(16 + (4 * (sext i32 %ld.b to i64))<nsw> + %a),+,32}<%loop> Added Flags: <nusw>
+; CHECK-EMPTY:
+; CHECK-NEXT: Expressions re-written:
+; CHECK-NEXT: [PSE] %gep.a.offset.2 = getelementptr i32, ptr %gep.a.offset, i32 4:
+; CHECK-NEXT: (16 + (4 * (sext i32 {%ld.b,+,8}<nw><%loop> to i64))<nsw> + %a)
+; CHECK-NEXT: --> {(16 + (4 * (sext i32 %ld.b to i64))<nsw> + %a),+,32}<%loop>
+; CHECK-NEXT: [PSE] %gep.a.offset.4 = getelementptr i32, ptr %a, i32 %offset.4:
+; CHECK-NEXT: ((4 * (sext i32 {(4 + %ld.b),+,8}<nw><%loop> to i64))<nsw> + %a)
+; CHECK-NEXT: --> {((4 * (sext i32 (4 + %ld.b) to i64))<nsw> + %a),+,32}<%loop>
+;
+entry:
+ %ld.b = load i32, ptr %b
+ %guard.cond = icmp slt i32 0, %ld.b
+ br i1 %guard.cond, label %exit, label %loop
+
+loop:
+ %iv = phi i32 [ %iv.next, %loop ], [ 0, %entry ]
+ %offset = add i32 %ld.b, %iv
+ %gep.a.offset = getelementptr i32, ptr %a, i32 %offset
+ %gep.a.offset.2 = getelementptr i32, ptr %gep.a.offset, i32 4
+ %ld.a = load [4 x i32], ptr %gep.a.offset.2
+ store [4 x i32] %ld.a, ptr %c
+ %offset.4 = add i32 %offset, 4
+ %gep.a.offset.4 = getelementptr i32, ptr %a, i32 %offset.4
+ store i32 0, ptr %gep.a.offset.4
+ %iv.next = add i32 %iv, 8
+ %exit.cond = icmp eq i32 %iv.next, 16
+ br i1 %exit.cond, label %exit, label %loop
+
+exit:
+ ret void
+}
+
+define void @safe_with_rtchecks_loopguards(i16 %n, ptr %p3, i16 noundef %q, ptr %p1, ptr %p2) {
+; CHECK-LABEL: 'safe_with_rtchecks_loopguards'
+; CHECK-NEXT: loop:
+; CHECK-NEXT: Memory dependences are safe with run-time checks
+; CHECK-NEXT: Dependences:
+; CHECK-NEXT: Run-time memory checks:
+; CHECK-NEXT: Check 0:
+; CHECK-NEXT: Comparing group GRP0:
+; CHECK-NEXT: %arrayidx22 = getelementptr inbounds [2 x i32], ptr %alloca, i16 %iv
+; CHECK-NEXT: Against group GRP1:
+; CHECK-NEXT: %arrayidx33 = getelementptr inbounds i8, ptr %arrayidx22, i16 4
+; CHECK-NEXT: Check 1:
+; CHECK-NEXT: Comparing group GRP0:
+; CHECK-NEXT: %arrayidx22 = getelementptr inbounds [2 x i32], ptr %alloca, i16 %iv
+; CHECK-NEXT: Against group GRP2:
+; CHECK-NEXT: %arrayidx42 = getelementptr inbounds [2 x i32], ptr %arrayidx40, i16 %iv
+; CHECK-NEXT: Check 2:
+; CHECK-NEXT: Comparing group GRP0:
+; CHECK-NEXT: %arrayidx22 = getelementptr inbounds [2 x i32], ptr %alloca, i16 %iv
+; CHECK-NEXT: Against group GRP3:
+; CHECK-NEXT: %arrayidx53 = getelementptr inbounds i8, ptr %arrayidx42, i16 4
+; CHECK-NEXT: Check 3:
+; CHECK-NEXT: Comparing group GRP1:
+; CHECK-NEXT: %arrayidx33 = getelementptr inbounds i8, ptr %arrayidx22, i16 4
+; CHECK-NEXT: Against group GRP2:
+; CHECK-NEXT: %arrayidx42 = getelementptr inbounds [2 x i32], ptr %arrayidx40, i16 %iv
+; CHECK-NEXT: Check 4:
+; CHECK-NEXT: Comparing group GRP1:
+; CHECK-NEXT: %arrayidx33 = getelementptr inbounds i8, ptr %arrayidx22, i16 4
+; CHECK-NEXT: Against group GRP3:
+; CHECK-NEXT: %arrayidx53 = getelementptr inbounds i8, ptr %arrayidx42, i16 4
+; CHECK-NEXT: Check 5:
+; CHECK-NEXT: Comparing group GRP2:
+; CHECK-NEXT: %arrayidx42 = getelementptr inbounds [2 x i32], ptr %arrayidx40, i16 %iv
+; CHECK-NEXT: Against group GRP3:
+; CHECK-NEXT: %arrayidx53 = getelementptr inbounds i8, ptr %arrayidx42, i16 4
+; CHECK-NEXT: Grouped accesses:
+; CHECK-NEXT: Group GRP0:
+; CHECK-NEXT: (Low: %alloca High: (4 + (8 * (zext i...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/161238
More information about the llvm-commits
mailing list