[llvm] LAA: fix logic for MaxTargetVectorWidth (PR #125487)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 3 04:13:13 PST 2025


https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/125487

Use TargetTransformInfo::enableScalableVectorization to choose Fixed register bitwidth.

>From 223f602f464a1d4bf79a69eea7745c41473172f6 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Mon, 3 Feb 2025 11:59:38 +0000
Subject: [PATCH] LAA: fix logic for MaxTargetVectorWidth

Use TargetTransformInfo::enableScalableVectorization to choose Fixed
register bitwidth.
---
 llvm/lib/Analysis/LoopAccessAnalysis.cpp      |  18 +-
 .../multiple-strides-rt-memory-checks.ll      |  60 ++-
 .../non-constant-distance-backward.ll         | 468 +++++++++++++-----
 3 files changed, 391 insertions(+), 155 deletions(-)

diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index ac8a35fbc54fb1..0ba654a6141e5b 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2999,20 +2999,12 @@ LoopAccessInfo::LoopAccessInfo(Loop *L, ScalarEvolution *SE,
     : PSE(std::make_unique<PredicatedScalarEvolution>(*SE, *L)),
       PtrRtChecking(nullptr), TheLoop(L) {
   unsigned MaxTargetVectorWidthInBits = std::numeric_limits<unsigned>::max();
-  if (TTI) {
-    TypeSize FixedWidth =
-        TTI->getRegisterBitWidth(TargetTransformInfo::RGK_FixedWidthVector);
-    if (FixedWidth.isNonZero()) {
-      // Scale the vector width by 2 as rough estimate to also consider
-      // interleaving.
-      MaxTargetVectorWidthInBits = FixedWidth.getFixedValue() * 2;
-    }
+  if (TTI && !TTI->enableScalableVectorization())
+    // Scale the vector width by 2 as rough estimate to also consider
+    // interleaving.
+    MaxTargetVectorWidthInBits =
+        TTI->getRegisterBitWidth(TargetTransformInfo::RGK_FixedWidthVector) * 2;
 
-    TypeSize ScalableWidth =
-        TTI->getRegisterBitWidth(TargetTransformInfo::RGK_ScalableVector);
-    if (ScalableWidth.isNonZero())
-      MaxTargetVectorWidthInBits = std::numeric_limits<unsigned>::max();
-  }
   DepChecker = std::make_unique<MemoryDepChecker>(*PSE, L, SymbolicStrides,
                                                   MaxTargetVectorWidthInBits);
   PtrRtChecking = std::make_unique<RuntimePointerChecking>(*DepChecker, SE);
diff --git a/llvm/test/Analysis/LoopAccessAnalysis/multiple-strides-rt-memory-checks.ll b/llvm/test/Analysis/LoopAccessAnalysis/multiple-strides-rt-memory-checks.ll
index cb50b2c75ccb7b..20fc0bea43b71b 100644
--- a/llvm/test/Analysis/LoopAccessAnalysis/multiple-strides-rt-memory-checks.ll
+++ b/llvm/test/Analysis/LoopAccessAnalysis/multiple-strides-rt-memory-checks.ll
@@ -1,10 +1,11 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
 ; RUN: opt -passes='print<access-info>' -disable-output  < %s 2>&1 | FileCheck %s
 
 ; This is the test case from PR26314.
-; When we were retrying dependence checking with memchecks only, 
-; the loop-invariant access in the inner loop was incorrectly determined to be wrapping 
+; When we were retrying dependence checking with memchecks only,
+; the loop-invariant access in the inner loop was incorrectly determined to be wrapping
 ; because it was not strided in the inner loop.
- 
+
 ; #define Z 32
 ; typedef struct s {
 ;	int v1[Z];
@@ -21,19 +22,52 @@
 ;    }
 ; }
 
-; CHECK: function 'Test':
-; CHECK:   .inner:
-; CHECK-NEXT:     Memory dependences are safe with run-time checks
-; CHECK-NEXT:     Dependences:
-; CHECK-NEXT:     Run-time memory checks:
-; CHECK:          Check 0:
-; CHECK:          Check 1:
-
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 
 %struct.s = type { [32 x i32], [32 x i32], [32 x [32 x i32]] }
 
 define void @Test(ptr nocapture %obj, i64 %z) #0 {
+; CHECK-LABEL: 'Test'
+; CHECK-NEXT:    .inner:
+; CHECK-NEXT:      Memory dependences are safe with a maximum safe vector width of 2048 bits with run-time checks
+; CHECK-NEXT:      Dependences:
+; CHECK-NEXT:      Run-time memory checks:
+; CHECK-NEXT:      Check 0:
+; CHECK-NEXT:        Comparing group ([[GRP1:0x[0-9a-f]+]]):
+; CHECK-NEXT:          %6 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 2, i64 %i, i64 %j
+; CHECK-NEXT:        Against group ([[GRP2:0x[0-9a-f]+]]):
+; CHECK-NEXT:          %2 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 0, i64 %j
+; CHECK-NEXT:      Check 1:
+; CHECK-NEXT:        Comparing group ([[GRP1]]):
+; CHECK-NEXT:          %6 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 2, i64 %i, i64 %j
+; CHECK-NEXT:        Against group ([[GRP3:0x[0-9a-f]+]]):
+; CHECK-NEXT:          %1 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 1, i64 %i
+; CHECK-NEXT:      Grouped accesses:
+; CHECK-NEXT:        Group [[GRP1]]:
+; CHECK-NEXT:          (Low: {(256 + %obj)<nuw>,+,128}<nuw><%.outer.preheader> High: {(256 + (4 * %z) + %obj),+,128}<nw><%.outer.preheader>)
+; CHECK-NEXT:            Member: {{\{\{}}(256 + %obj)<nuw>,+,128}<nuw><%.outer.preheader>,+,4}<nuw><%.inner>
+; CHECK-NEXT:        Group [[GRP2]]:
+; CHECK-NEXT:          (Low: %obj High: ((4 * %z) + %obj))
+; CHECK-NEXT:            Member: {%obj,+,4}<nuw><%.inner>
+; CHECK-NEXT:        Group [[GRP3]]:
+; CHECK-NEXT:          (Low: {(128 + %obj)<nuw>,+,4}<nuw><%.outer.preheader> High: {(132 + %obj),+,4}<nw><%.outer.preheader>)
+; CHECK-NEXT:            Member: {(128 + %obj)<nuw>,+,4}<nuw><%.outer.preheader>
+; 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:
+; CHECK-NEXT:    .outer.preheader:
+; CHECK-NEXT:      Report: loop is not the innermost loop
+; 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:
+;
   br label %.outer.preheader
 
 
@@ -44,7 +78,7 @@ define void @Test(ptr nocapture %obj, i64 %z) #0 {
 
 .exit:
   ret void
- 
+
 .outer:
   %i.next = add nuw nsw i64 %i, 1
   %exitcond.outer = icmp eq i64 %i.next, 32
@@ -59,7 +93,7 @@ define void @Test(ptr nocapture %obj, i64 %z) #0 {
   %6 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 2, i64 %i, i64 %j
   %7 = load i32, ptr %6
   %8 = add nsw i32 %5, %7
-  store i32 %8, ptr %6  
+  store i32 %8, ptr %6
   %j.next = add nuw nsw i64 %j, 1
   %exitcond.inner = icmp eq i64 %j.next, %z
   br i1 %exitcond.inner, label %.outer, label %.inner
diff --git a/llvm/test/Analysis/LoopAccessAnalysis/non-constant-distance-backward.ll b/llvm/test/Analysis/LoopAccessAnalysis/non-constant-distance-backward.ll
index 0058135a30d670..e03872e00efb4f 100644
--- a/llvm/test/Analysis/LoopAccessAnalysis/non-constant-distance-backward.ll
+++ b/llvm/test/Analysis/LoopAccessAnalysis/non-constant-distance-backward.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
-; RUN: opt -passes='print<access-info>' -disable-output %s 2>&1 | FileCheck --check-prefixes=COMMON,MAXLEN %s
-; RUN: opt -passes='print<access-info>' -disable-output -mtriple=arm64-apple-macosx %s 2>&1 | FileCheck --check-prefixes=COMMON,VW128 %s
-; RUN: opt -passes='print<access-info>' -disable-output -mtriple=arm64-apple-macosx -mattr=+sve %s 2>&1 | FileCheck --check-prefixes=COMMON,MAXLEN %s
+; RUN: opt -passes='print<access-info>' -disable-output %s 2>&1 | FileCheck %s
+; RUN: opt -passes='print<access-info>' -disable-output -mtriple=arm64-apple-macosx %s 2>&1 | FileCheck --check-prefixes=VW128 %s
+; RUN: opt -passes='print<access-info>' -disable-output -mtriple=arm64-apple-macosx -mattr=+sve %s 2>&1 | FileCheck --check-prefixes=MAXLEN %s
 
 ; REQUIRES: aarch64-registered-target
 
@@ -10,38 +10,104 @@ target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
 ; If the dependence distance is not a constant, whether it gets identified as backwards or unknown depends on the minimum distance and the target's vector length.
 
 define void @backward_min_distance_8(ptr %A, i64 %N) {
-; COMMON-LABEL: 'backward_min_distance_8'
-; COMMON-NEXT:    loop:
-; COMMON-NEXT:      Memory dependences are safe with run-time checks
-; COMMON-NEXT:      Dependences:
-; COMMON-NEXT:      Run-time memory checks:
-; COMMON-NEXT:      Check 0:
-; COMMON-NEXT:        Comparing group ([[GRP1:0x[0-9a-f]+]]):
-; COMMON-NEXT:          %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv
-; COMMON-NEXT:        Against group ([[GRP2:0x[0-9a-f]+]]):
-; COMMON-NEXT:          %gep = getelementptr inbounds i8, ptr %A, i64 %iv
-; COMMON-NEXT:      Grouped accesses:
-; COMMON-NEXT:        Group [[GRP1]]:
-; COMMON-NEXT:          (Low: {(1 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(257 + %A),+,1}<nw><%outer.header>)
-; COMMON-NEXT:            Member: {{\{\{}}(1 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>
-; COMMON-NEXT:        Group [[GRP2]]:
-; COMMON-NEXT:          (Low: %A High: (256 + %A))
-; COMMON-NEXT:            Member: {%A,+,1}<nuw><%loop>
-; COMMON-EMPTY:
-; COMMON-NEXT:      Non vectorizable stores to invariant address were not found in loop.
-; COMMON-NEXT:      SCEV assumptions:
-; COMMON-EMPTY:
-; COMMON-NEXT:      Expressions re-written:
-; COMMON-NEXT:    outer.header:
-; COMMON-NEXT:      Report: loop is not the innermost loop
-; COMMON-NEXT:      Dependences:
-; COMMON-NEXT:      Run-time memory checks:
-; COMMON-NEXT:      Grouped accesses:
-; COMMON-EMPTY:
-; COMMON-NEXT:      Non vectorizable stores to invariant address were not found in loop.
-; COMMON-NEXT:      SCEV assumptions:
-; COMMON-EMPTY:
-; COMMON-NEXT:      Expressions re-written:
+; CHECK-LABEL: 'backward_min_distance_8'
+; 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 ([[GRP1:0x[0-9a-f]+]]):
+; CHECK-NEXT:          %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv
+; CHECK-NEXT:        Against group ([[GRP2:0x[0-9a-f]+]]):
+; CHECK-NEXT:          %gep = getelementptr inbounds i8, ptr %A, i64 %iv
+; CHECK-NEXT:      Grouped accesses:
+; CHECK-NEXT:        Group [[GRP1]]:
+; CHECK-NEXT:          (Low: {(1 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(257 + %A),+,1}<nw><%outer.header>)
+; CHECK-NEXT:            Member: {{\{\{}}(1 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>
+; CHECK-NEXT:        Group [[GRP2]]:
+; CHECK-NEXT:          (Low: %A High: (256 + %A))
+; CHECK-NEXT:            Member: {%A,+,1}<nuw><%loop>
+; 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:
+; CHECK-NEXT:    outer.header:
+; CHECK-NEXT:      Report: loop is not the innermost loop
+; 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:
+;
+; VW128-LABEL: 'backward_min_distance_8'
+; VW128-NEXT:    loop:
+; VW128-NEXT:      Memory dependences are safe with run-time checks
+; VW128-NEXT:      Dependences:
+; VW128-NEXT:      Run-time memory checks:
+; VW128-NEXT:      Check 0:
+; VW128-NEXT:        Comparing group ([[GRP3:0x[0-9a-f]+]]):
+; VW128-NEXT:          %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv
+; VW128-NEXT:        Against group ([[GRP4:0x[0-9a-f]+]]):
+; VW128-NEXT:          %gep = getelementptr inbounds i8, ptr %A, i64 %iv
+; VW128-NEXT:      Grouped accesses:
+; VW128-NEXT:        Group [[GRP3]]:
+; VW128-NEXT:          (Low: {(1 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(257 + %A),+,1}<nw><%outer.header>)
+; VW128-NEXT:            Member: {{\{\{}}(1 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>
+; VW128-NEXT:        Group [[GRP4]]:
+; VW128-NEXT:          (Low: %A High: (256 + %A))
+; VW128-NEXT:            Member: {%A,+,1}<nuw><%loop>
+; VW128-EMPTY:
+; VW128-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; VW128-NEXT:      SCEV assumptions:
+; VW128-EMPTY:
+; VW128-NEXT:      Expressions re-written:
+; VW128-NEXT:    outer.header:
+; VW128-NEXT:      Report: loop is not the innermost loop
+; VW128-NEXT:      Dependences:
+; VW128-NEXT:      Run-time memory checks:
+; VW128-NEXT:      Grouped accesses:
+; VW128-EMPTY:
+; VW128-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; VW128-NEXT:      SCEV assumptions:
+; VW128-EMPTY:
+; VW128-NEXT:      Expressions re-written:
+;
+; MAXLEN-LABEL: 'backward_min_distance_8'
+; MAXLEN-NEXT:    loop:
+; MAXLEN-NEXT:      Memory dependences are safe with run-time checks
+; MAXLEN-NEXT:      Dependences:
+; MAXLEN-NEXT:      Run-time memory checks:
+; MAXLEN-NEXT:      Check 0:
+; MAXLEN-NEXT:        Comparing group ([[GRP5:0x[0-9a-f]+]]):
+; MAXLEN-NEXT:          %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv
+; MAXLEN-NEXT:        Against group ([[GRP6:0x[0-9a-f]+]]):
+; MAXLEN-NEXT:          %gep = getelementptr inbounds i8, ptr %A, i64 %iv
+; MAXLEN-NEXT:      Grouped accesses:
+; MAXLEN-NEXT:        Group [[GRP5]]:
+; MAXLEN-NEXT:          (Low: {(1 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(257 + %A),+,1}<nw><%outer.header>)
+; MAXLEN-NEXT:            Member: {{\{\{}}(1 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>
+; MAXLEN-NEXT:        Group [[GRP6]]:
+; MAXLEN-NEXT:          (Low: %A High: (256 + %A))
+; MAXLEN-NEXT:            Member: {%A,+,1}<nuw><%loop>
+; MAXLEN-EMPTY:
+; MAXLEN-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; MAXLEN-NEXT:      SCEV assumptions:
+; MAXLEN-EMPTY:
+; MAXLEN-NEXT:      Expressions re-written:
+; MAXLEN-NEXT:    outer.header:
+; MAXLEN-NEXT:      Report: loop is not the innermost loop
+; MAXLEN-NEXT:      Dependences:
+; MAXLEN-NEXT:      Run-time memory checks:
+; MAXLEN-NEXT:      Grouped accesses:
+; MAXLEN-EMPTY:
+; MAXLEN-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; MAXLEN-NEXT:      SCEV assumptions:
+; MAXLEN-EMPTY:
+; MAXLEN-NEXT:      Expressions re-written:
 ;
 entry:
   br label %outer.header
@@ -72,38 +138,97 @@ exit:
 }
 
 define void @backward_min_distance_120(ptr %A, i64 %N) {
-; COMMON-LABEL: 'backward_min_distance_120'
-; COMMON-NEXT:    loop:
-; COMMON-NEXT:      Memory dependences are safe with run-time checks
-; COMMON-NEXT:      Dependences:
-; COMMON-NEXT:      Run-time memory checks:
-; COMMON-NEXT:      Check 0:
-; COMMON-NEXT:        Comparing group ([[GRP3:0x[0-9a-f]+]]):
-; COMMON-NEXT:          %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv
-; COMMON-NEXT:        Against group ([[GRP4:0x[0-9a-f]+]]):
-; COMMON-NEXT:          %gep = getelementptr inbounds i8, ptr %A, i64 %iv
-; COMMON-NEXT:      Grouped accesses:
-; COMMON-NEXT:        Group [[GRP3]]:
-; COMMON-NEXT:          (Low: {(15 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(271 + %A),+,1}<nw><%outer.header>)
-; COMMON-NEXT:            Member: {{\{\{}}(15 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>
-; COMMON-NEXT:        Group [[GRP4]]:
-; COMMON-NEXT:          (Low: %A High: (256 + %A))
-; COMMON-NEXT:            Member: {%A,+,1}<nuw><%loop>
-; COMMON-EMPTY:
-; COMMON-NEXT:      Non vectorizable stores to invariant address were not found in loop.
-; COMMON-NEXT:      SCEV assumptions:
-; COMMON-EMPTY:
-; COMMON-NEXT:      Expressions re-written:
-; COMMON-NEXT:    outer.header:
-; COMMON-NEXT:      Report: loop is not the innermost loop
-; COMMON-NEXT:      Dependences:
-; COMMON-NEXT:      Run-time memory checks:
-; COMMON-NEXT:      Grouped accesses:
-; COMMON-EMPTY:
-; COMMON-NEXT:      Non vectorizable stores to invariant address were not found in loop.
-; COMMON-NEXT:      SCEV assumptions:
-; COMMON-EMPTY:
-; COMMON-NEXT:      Expressions re-written:
+; CHECK-LABEL: 'backward_min_distance_120'
+; CHECK-NEXT:    loop:
+; CHECK-NEXT:      Memory dependences are safe with a maximum safe vector width of 120 bits
+; CHECK-NEXT:      Dependences:
+; CHECK-NEXT:        BackwardVectorizable:
+; CHECK-NEXT:            %l = load i8, ptr %gep, align 4 ->
+; CHECK-NEXT:            store i8 %add, ptr %gep.off.iv, align 4
+; 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:
+; CHECK-NEXT:    outer.header:
+; CHECK-NEXT:      Report: loop is not the innermost loop
+; 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:
+;
+; VW128-LABEL: 'backward_min_distance_120'
+; VW128-NEXT:    loop:
+; VW128-NEXT:      Memory dependences are safe with run-time checks
+; VW128-NEXT:      Dependences:
+; VW128-NEXT:      Run-time memory checks:
+; VW128-NEXT:      Check 0:
+; VW128-NEXT:        Comparing group ([[GRP7:0x[0-9a-f]+]]):
+; VW128-NEXT:          %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv
+; VW128-NEXT:        Against group ([[GRP8:0x[0-9a-f]+]]):
+; VW128-NEXT:          %gep = getelementptr inbounds i8, ptr %A, i64 %iv
+; VW128-NEXT:      Grouped accesses:
+; VW128-NEXT:        Group [[GRP7]]:
+; VW128-NEXT:          (Low: {(15 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(271 + %A),+,1}<nw><%outer.header>)
+; VW128-NEXT:            Member: {{\{\{}}(15 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>
+; VW128-NEXT:        Group [[GRP8]]:
+; VW128-NEXT:          (Low: %A High: (256 + %A))
+; VW128-NEXT:            Member: {%A,+,1}<nuw><%loop>
+; VW128-EMPTY:
+; VW128-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; VW128-NEXT:      SCEV assumptions:
+; VW128-EMPTY:
+; VW128-NEXT:      Expressions re-written:
+; VW128-NEXT:    outer.header:
+; VW128-NEXT:      Report: loop is not the innermost loop
+; VW128-NEXT:      Dependences:
+; VW128-NEXT:      Run-time memory checks:
+; VW128-NEXT:      Grouped accesses:
+; VW128-EMPTY:
+; VW128-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; VW128-NEXT:      SCEV assumptions:
+; VW128-EMPTY:
+; VW128-NEXT:      Expressions re-written:
+;
+; MAXLEN-LABEL: 'backward_min_distance_120'
+; MAXLEN-NEXT:    loop:
+; MAXLEN-NEXT:      Memory dependences are safe with run-time checks
+; MAXLEN-NEXT:      Dependences:
+; MAXLEN-NEXT:      Run-time memory checks:
+; MAXLEN-NEXT:      Check 0:
+; MAXLEN-NEXT:        Comparing group ([[GRP9:0x[0-9a-f]+]]):
+; MAXLEN-NEXT:          %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv
+; MAXLEN-NEXT:        Against group ([[GRP10:0x[0-9a-f]+]]):
+; MAXLEN-NEXT:          %gep = getelementptr inbounds i8, ptr %A, i64 %iv
+; MAXLEN-NEXT:      Grouped accesses:
+; MAXLEN-NEXT:        Group [[GRP9]]:
+; MAXLEN-NEXT:          (Low: {(15 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(271 + %A),+,1}<nw><%outer.header>)
+; MAXLEN-NEXT:            Member: {{\{\{}}(15 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>
+; MAXLEN-NEXT:        Group [[GRP10]]:
+; MAXLEN-NEXT:          (Low: %A High: (256 + %A))
+; MAXLEN-NEXT:            Member: {%A,+,1}<nuw><%loop>
+; MAXLEN-EMPTY:
+; MAXLEN-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; MAXLEN-NEXT:      SCEV assumptions:
+; MAXLEN-EMPTY:
+; MAXLEN-NEXT:      Expressions re-written:
+; MAXLEN-NEXT:    outer.header:
+; MAXLEN-NEXT:      Report: loop is not the innermost loop
+; MAXLEN-NEXT:      Dependences:
+; MAXLEN-NEXT:      Run-time memory checks:
+; MAXLEN-NEXT:      Grouped accesses:
+; MAXLEN-EMPTY:
+; MAXLEN-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; MAXLEN-NEXT:      SCEV assumptions:
+; MAXLEN-EMPTY:
+; MAXLEN-NEXT:      Expressions re-written:
 ;
 entry:
   br label %outer.header
@@ -134,38 +259,97 @@ exit:
 }
 
 define void @backward_min_distance_128(ptr %A, i64 %N) {
-; COMMON-LABEL: 'backward_min_distance_128'
-; COMMON-NEXT:    loop:
-; COMMON-NEXT:      Memory dependences are safe with run-time checks
-; COMMON-NEXT:      Dependences:
-; COMMON-NEXT:      Run-time memory checks:
-; COMMON-NEXT:      Check 0:
-; COMMON-NEXT:        Comparing group ([[GRP13:0x[0-9a-f]+]]):
-; COMMON-NEXT:          %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv
-; COMMON-NEXT:        Against group ([[GRP14:0x[0-9a-f]+]]):
-; COMMON-NEXT:          %gep = getelementptr inbounds i8, ptr %A, i64 %iv
-; COMMON-NEXT:      Grouped accesses:
-; COMMON-NEXT:        Group [[GRP13]]:
-; COMMON-NEXT:          (Low: {(16 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(272 + %A),+,1}<nw><%outer.header>)
-; COMMON-NEXT:            Member: {{\{\{}}(16 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>
-; COMMON-NEXT:        Group [[GRP14]]:
-; COMMON-NEXT:          (Low: %A High: (256 + %A))
-; COMMON-NEXT:            Member: {%A,+,1}<nuw><%loop>
-; COMMON-EMPTY:
-; COMMON-NEXT:      Non vectorizable stores to invariant address were not found in loop.
-; COMMON-NEXT:      SCEV assumptions:
-; COMMON-EMPTY:
-; COMMON-NEXT:      Expressions re-written:
-; COMMON-NEXT:    outer.header:
-; COMMON-NEXT:      Report: loop is not the innermost loop
-; COMMON-NEXT:      Dependences:
-; COMMON-NEXT:      Run-time memory checks:
-; COMMON-NEXT:      Grouped accesses:
-; COMMON-EMPTY:
-; COMMON-NEXT:      Non vectorizable stores to invariant address were not found in loop.
-; COMMON-NEXT:      SCEV assumptions:
-; COMMON-EMPTY:
-; COMMON-NEXT:      Expressions re-written:
+; CHECK-LABEL: 'backward_min_distance_128'
+; CHECK-NEXT:    loop:
+; CHECK-NEXT:      Memory dependences are safe with a maximum safe vector width of 128 bits
+; CHECK-NEXT:      Dependences:
+; CHECK-NEXT:        BackwardVectorizable:
+; CHECK-NEXT:            %l = load i8, ptr %gep, align 4 ->
+; CHECK-NEXT:            store i8 %add, ptr %gep.off.iv, align 4
+; 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:
+; CHECK-NEXT:    outer.header:
+; CHECK-NEXT:      Report: loop is not the innermost loop
+; 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:
+;
+; VW128-LABEL: 'backward_min_distance_128'
+; VW128-NEXT:    loop:
+; VW128-NEXT:      Memory dependences are safe with run-time checks
+; VW128-NEXT:      Dependences:
+; VW128-NEXT:      Run-time memory checks:
+; VW128-NEXT:      Check 0:
+; VW128-NEXT:        Comparing group ([[GRP11:0x[0-9a-f]+]]):
+; VW128-NEXT:          %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv
+; VW128-NEXT:        Against group ([[GRP12:0x[0-9a-f]+]]):
+; VW128-NEXT:          %gep = getelementptr inbounds i8, ptr %A, i64 %iv
+; VW128-NEXT:      Grouped accesses:
+; VW128-NEXT:        Group [[GRP11]]:
+; VW128-NEXT:          (Low: {(16 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(272 + %A),+,1}<nw><%outer.header>)
+; VW128-NEXT:            Member: {{\{\{}}(16 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>
+; VW128-NEXT:        Group [[GRP12]]:
+; VW128-NEXT:          (Low: %A High: (256 + %A))
+; VW128-NEXT:            Member: {%A,+,1}<nuw><%loop>
+; VW128-EMPTY:
+; VW128-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; VW128-NEXT:      SCEV assumptions:
+; VW128-EMPTY:
+; VW128-NEXT:      Expressions re-written:
+; VW128-NEXT:    outer.header:
+; VW128-NEXT:      Report: loop is not the innermost loop
+; VW128-NEXT:      Dependences:
+; VW128-NEXT:      Run-time memory checks:
+; VW128-NEXT:      Grouped accesses:
+; VW128-EMPTY:
+; VW128-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; VW128-NEXT:      SCEV assumptions:
+; VW128-EMPTY:
+; VW128-NEXT:      Expressions re-written:
+;
+; MAXLEN-LABEL: 'backward_min_distance_128'
+; MAXLEN-NEXT:    loop:
+; MAXLEN-NEXT:      Memory dependences are safe with run-time checks
+; MAXLEN-NEXT:      Dependences:
+; MAXLEN-NEXT:      Run-time memory checks:
+; MAXLEN-NEXT:      Check 0:
+; MAXLEN-NEXT:        Comparing group ([[GRP13:0x[0-9a-f]+]]):
+; MAXLEN-NEXT:          %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv
+; MAXLEN-NEXT:        Against group ([[GRP14:0x[0-9a-f]+]]):
+; MAXLEN-NEXT:          %gep = getelementptr inbounds i8, ptr %A, i64 %iv
+; MAXLEN-NEXT:      Grouped accesses:
+; MAXLEN-NEXT:        Group [[GRP13]]:
+; MAXLEN-NEXT:          (Low: {(16 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(272 + %A),+,1}<nw><%outer.header>)
+; MAXLEN-NEXT:            Member: {{\{\{}}(16 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>
+; MAXLEN-NEXT:        Group [[GRP14]]:
+; MAXLEN-NEXT:          (Low: %A High: (256 + %A))
+; MAXLEN-NEXT:            Member: {%A,+,1}<nuw><%loop>
+; MAXLEN-EMPTY:
+; MAXLEN-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; MAXLEN-NEXT:      SCEV assumptions:
+; MAXLEN-EMPTY:
+; MAXLEN-NEXT:      Expressions re-written:
+; MAXLEN-NEXT:    outer.header:
+; MAXLEN-NEXT:      Report: loop is not the innermost loop
+; MAXLEN-NEXT:      Dependences:
+; MAXLEN-NEXT:      Run-time memory checks:
+; MAXLEN-NEXT:      Grouped accesses:
+; MAXLEN-EMPTY:
+; MAXLEN-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; MAXLEN-NEXT:      SCEV assumptions:
+; MAXLEN-EMPTY:
+; MAXLEN-NEXT:      Expressions re-written:
 ;
 entry:
   br label %outer.header
@@ -196,21 +380,73 @@ exit:
 }
 
 define void @backward_min_distance_256(ptr %A, i64 %N) {
+; CHECK-LABEL: 'backward_min_distance_256'
+; CHECK-NEXT:    loop:
+; CHECK-NEXT:      Memory dependences are safe with a maximum safe vector width of 256 bits
+; CHECK-NEXT:      Dependences:
+; CHECK-NEXT:        BackwardVectorizable:
+; CHECK-NEXT:            %l = load i8, ptr %gep, align 4 ->
+; CHECK-NEXT:            store i8 %add, ptr %gep.off.iv, align 4
+; 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:
+; CHECK-NEXT:    outer.header:
+; CHECK-NEXT:      Report: loop is not the innermost loop
+; 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:
+;
+; VW128-LABEL: 'backward_min_distance_256'
+; VW128-NEXT:    loop:
+; VW128-NEXT:      Memory dependences are safe with a maximum safe vector width of 256 bits
+; VW128-NEXT:      Dependences:
+; VW128-NEXT:        BackwardVectorizable:
+; VW128-NEXT:            %l = load i8, ptr %gep, align 4 ->
+; VW128-NEXT:            store i8 %add, ptr %gep.off.iv, align 4
+; VW128-EMPTY:
+; VW128-NEXT:      Run-time memory checks:
+; VW128-NEXT:      Grouped accesses:
+; VW128-EMPTY:
+; VW128-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; VW128-NEXT:      SCEV assumptions:
+; VW128-EMPTY:
+; VW128-NEXT:      Expressions re-written:
+; VW128-NEXT:    outer.header:
+; VW128-NEXT:      Report: loop is not the innermost loop
+; VW128-NEXT:      Dependences:
+; VW128-NEXT:      Run-time memory checks:
+; VW128-NEXT:      Grouped accesses:
+; VW128-EMPTY:
+; VW128-NEXT:      Non vectorizable stores to invariant address were not found in loop.
+; VW128-NEXT:      SCEV assumptions:
+; VW128-EMPTY:
+; VW128-NEXT:      Expressions re-written:
+;
 ; MAXLEN-LABEL: 'backward_min_distance_256'
 ; MAXLEN-NEXT:    loop:
 ; MAXLEN-NEXT:      Memory dependences are safe with run-time checks
 ; MAXLEN-NEXT:      Dependences:
 ; MAXLEN-NEXT:      Run-time memory checks:
 ; MAXLEN-NEXT:      Check 0:
-; MAXLEN-NEXT:        Comparing group ([[GRP17:0x[0-9a-f]+]]):
+; MAXLEN-NEXT:        Comparing group ([[GRP15:0x[0-9a-f]+]]):
 ; MAXLEN-NEXT:          %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv
-; MAXLEN-NEXT:        Against group ([[GRP18:0x[0-9a-f]+]]):
+; MAXLEN-NEXT:        Against group ([[GRP16:0x[0-9a-f]+]]):
 ; MAXLEN-NEXT:          %gep = getelementptr inbounds i8, ptr %A, i64 %iv
 ; MAXLEN-NEXT:      Grouped accesses:
-; MAXLEN-NEXT:        Group [[GRP17]]:
+; MAXLEN-NEXT:        Group [[GRP15]]:
 ; MAXLEN-NEXT:          (Low: {(32 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(288 + %A),+,1}<nw><%outer.header>)
 ; MAXLEN-NEXT:            Member: {{\{\{}}(32 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>
-; MAXLEN-NEXT:        Group [[GRP18]]:
+; MAXLEN-NEXT:        Group [[GRP16]]:
 ; MAXLEN-NEXT:          (Low: %A High: (256 + %A))
 ; MAXLEN-NEXT:            Member: {%A,+,1}<nuw><%loop>
 ; MAXLEN-EMPTY:
@@ -229,32 +465,6 @@ define void @backward_min_distance_256(ptr %A, i64 %N) {
 ; MAXLEN-EMPTY:
 ; MAXLEN-NEXT:      Expressions re-written:
 ;
-; VW128-LABEL: 'backward_min_distance_256'
-; VW128-NEXT:    loop:
-; VW128-NEXT:      Memory dependences are safe with a maximum safe vector width of 256 bits
-; VW128-NEXT:      Dependences:
-; VW128-NEXT:        BackwardVectorizable:
-; VW128-NEXT:            %l = load i8, ptr %gep, align 4 ->
-; VW128-NEXT:            store i8 %add, ptr %gep.off.iv, align 4
-; VW128-EMPTY:
-; VW128-NEXT:      Run-time memory checks:
-; VW128-NEXT:      Grouped accesses:
-; VW128-EMPTY:
-; VW128-NEXT:      Non vectorizable stores to invariant address were not found in loop.
-; VW128-NEXT:      SCEV assumptions:
-; VW128-EMPTY:
-; VW128-NEXT:      Expressions re-written:
-; VW128-NEXT:    outer.header:
-; VW128-NEXT:      Report: loop is not the innermost loop
-; VW128-NEXT:      Dependences:
-; VW128-NEXT:      Run-time memory checks:
-; VW128-NEXT:      Grouped accesses:
-; VW128-EMPTY:
-; VW128-NEXT:      Non vectorizable stores to invariant address were not found in loop.
-; VW128-NEXT:      SCEV assumptions:
-; VW128-EMPTY:
-; VW128-NEXT:      Expressions re-written:
-;
 entry:
   br label %outer.header
 



More information about the llvm-commits mailing list