[llvm] LDist/test: clean up and modernize (NFC) (PR #97822)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 5 05:56:34 PDT 2024
https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/97822
Clean up unused triple/datalayout lines, strengthen RUN lines to include -verify-loop-info/-verify-dom-info, and regenerate tests with UpdateTestChecks where appropriate.
>From dc78e7d6acefc38b4af1c7eeeb90a006e608ccd5 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Fri, 5 Jul 2024 13:09:09 +0100
Subject: [PATCH] LDist/test: clean up and modernize (NFC)
Clean up unused triple/datalayout lines, strengthen RUN lines to include
-verify-loop-info/-verify-dom-info, and regenerate tests with
UpdateTestChecks where appropriate.
---
llvm/test/Transforms/LoopDistribute/basic.ll | 15 +--
.../LoopDistribute/bounds-expansion-bug.ll | 8 +-
.../crash-in-memcheck-generation.ll | 15 +--
.../diagnostics-with-hotness.ll | 3 -
.../Transforms/LoopDistribute/diagnostics.ll | 3 -
.../LoopDistribute/disable_nonforced.ll | 9 +-
.../disable_nonforced_enable.ll | 9 +-
.../Transforms/LoopDistribute/early-exit.ll | 4 -
.../Transforms/LoopDistribute/followup.ll | 127 +++++++++++++++---
.../Transforms/LoopDistribute/metadata.ll | 19 +--
.../LoopDistribute/no-if-convert.ll | 81 +++++++----
.../Transforms/LoopDistribute/outside-use.ll | 94 ++++++++++---
.../LoopDistribute/pointer-phi-in-loop.ll | 66 ++++++++-
.../test/Transforms/LoopDistribute/pr28443.ll | 33 +++--
.../LoopDistribute/program-order.ll | 43 +++---
.../scev-inserted-runtime-check.ll | 4 +-
.../LoopDistribute/symbolic-stride.ll | 11 +-
.../uncomputable-backedge-taken-count.ll | 11 +-
.../unknown-bounds-for-memchecks.ll | 33 ++++-
19 files changed, 395 insertions(+), 193 deletions(-)
diff --git a/llvm/test/Transforms/LoopDistribute/basic.ll b/llvm/test/Transforms/LoopDistribute/basic.ll
index 1e4778dfa094c..04e452d0bb32b 100644
--- a/llvm/test/Transforms/LoopDistribute/basic.ll
+++ b/llvm/test/Transforms/LoopDistribute/basic.ll
@@ -15,15 +15,8 @@
; C[i] = D[i] * E[i];
; }
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.10.0"
-
; CHECK-LABEL: @f(
-define void @f(ptr noalias %a,
- ptr noalias %b,
- ptr noalias %c,
- ptr noalias %d,
- ptr noalias %e) {
+define void @f(ptr noalias %a, ptr noalias %b, ptr noalias %c, ptr noalias %d, ptr noalias %e) {
entry:
br label %for.body
@@ -88,11 +81,7 @@ declare i32 @llvm.convergent(i32) #0
; It is OK to distribute with a convergent operation, since in each
; new loop the convergent operation has the ssame control dependency.
; CHECK-LABEL: @f_with_convergent(
-define void @f_with_convergent(ptr noalias %a,
- ptr noalias %b,
- ptr noalias %c,
- ptr noalias %d,
- ptr noalias %e) {
+define void @f_with_convergent(ptr noalias %a, ptr noalias %b, ptr noalias %c, ptr noalias %d, ptr noalias %e) {
entry:
br label %for.body
diff --git a/llvm/test/Transforms/LoopDistribute/bounds-expansion-bug.ll b/llvm/test/Transforms/LoopDistribute/bounds-expansion-bug.ll
index be3b48dcfacf5..b00c1bf98ab12 100644
--- a/llvm/test/Transforms/LoopDistribute/bounds-expansion-bug.ll
+++ b/llvm/test/Transforms/LoopDistribute/bounds-expansion-bug.ll
@@ -14,13 +14,7 @@
; can get earlier expanded values invalidated when casts are used. This test
; ensure that we are not using the invalidated values.
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-
-define void @f(ptr %a1, ptr %a2,
- ptr %b,
- ptr %c1, ptr %c2,
- ptr %d,
- ptr %e) {
+define void @f(ptr %a1, ptr %a2, ptr %b, ptr %c1, ptr %c2, ptr %d, ptr %e) {
entry:
%cond = icmp eq ptr %e, null
diff --git a/llvm/test/Transforms/LoopDistribute/crash-in-memcheck-generation.ll b/llvm/test/Transforms/LoopDistribute/crash-in-memcheck-generation.ll
index 40193f0cb6bdf..f4c9fd3514363 100644
--- a/llvm/test/Transforms/LoopDistribute/crash-in-memcheck-generation.ll
+++ b/llvm/test/Transforms/LoopDistribute/crash-in-memcheck-generation.ll
@@ -11,19 +11,12 @@
; C[i] = D[i] * E[i];
; }
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.10.0"
-
-define void @f(ptr %a,
- ptr %b,
- ptr noalias %c,
- ptr noalias %d,
- ptr noalias %e) {
-entry:
- br label %for.body
-
+define void @f(ptr %a, ptr %b, ptr noalias %c, ptr noalias %d, ptr noalias %e) {
+; CHECK-LABEL: @f(
; CHECK-NOT: memcheck:
; CHECK: mul <4 x i32>
+entry:
+ br label %for.body
for.body: ; preds = %for.body, %entry
%ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
diff --git a/llvm/test/Transforms/LoopDistribute/diagnostics-with-hotness.ll b/llvm/test/Transforms/LoopDistribute/diagnostics-with-hotness.ll
index 6f36f4d263f43..b5ef3578eadd9 100644
--- a/llvm/test/Transforms/LoopDistribute/diagnostics-with-hotness.ll
+++ b/llvm/test/Transforms/LoopDistribute/diagnostics-with-hotness.ll
@@ -21,9 +21,6 @@
; 5 }
; 6 }
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.11.0"
-
; HOTNESS: remark: /tmp/t.c:3:3: loop not distributed: use -Rpass-analysis=loop-distribute for more info (hotness: 300)
; HOTNESS: remark: /tmp/t.c:3:3: loop not distributed: memory operations are safe for vectorization (hotness: 300)
; NO_HOTNESS: remark: /tmp/t.c:3:3: loop not distributed: use -Rpass-analysis=loop-distribute for more info{{$}}
diff --git a/llvm/test/Transforms/LoopDistribute/diagnostics.ll b/llvm/test/Transforms/LoopDistribute/diagnostics.ll
index e824eb42b9e38..e6a0d83bd63d2 100644
--- a/llvm/test/Transforms/LoopDistribute/diagnostics.ll
+++ b/llvm/test/Transforms/LoopDistribute/diagnostics.ll
@@ -32,9 +32,6 @@
; 18 }
; 19 }
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.11.0"
-
; MISSED_REMARKS: remark: /tmp/t.c:3:3: loop not distributed: use -Rpass-analysis=loop-distribute for more info
; ALWAYS: remark: /tmp/t.c:3:3: loop not distributed: memory operations are safe for vectorization
; ALWAYS: warning: /tmp/t.c:3:3: loop not distributed: failed explicitly specified loop distribution
diff --git a/llvm/test/Transforms/LoopDistribute/disable_nonforced.ll b/llvm/test/Transforms/LoopDistribute/disable_nonforced.ll
index f667b86a8a246..1b3985a43c5be 100644
--- a/llvm/test/Transforms/LoopDistribute/disable_nonforced.ll
+++ b/llvm/test/Transforms/LoopDistribute/disable_nonforced.ll
@@ -1,16 +1,11 @@
-; RUN: opt -passes=loop-distribute -enable-loop-distribute=1 -S < %s | FileCheck %s
+; RUN: opt -passes=loop-distribute -enable-loop-distribute -verify-loop-info -verify-dom-info -S < %s | FileCheck %s
;
; Check that the disable_nonforced is honored by loop distribution.
;
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+define void @disable_nonforced(ptr noalias %a, ptr noalias %b, ptr noalias %c, ptr noalias %d, ptr noalias %e) {
; CHECK-LABEL: @disable_nonforced(
; CHECK-NOT: for.body.ldist1:
-define void @disable_nonforced(ptr noalias %a,
- ptr noalias %b,
- ptr noalias %c,
- ptr noalias %d,
- ptr noalias %e) {
entry:
br label %for.body
diff --git a/llvm/test/Transforms/LoopDistribute/disable_nonforced_enable.ll b/llvm/test/Transforms/LoopDistribute/disable_nonforced_enable.ll
index 794d7b1ee2a3a..45a2d31256a27 100644
--- a/llvm/test/Transforms/LoopDistribute/disable_nonforced_enable.ll
+++ b/llvm/test/Transforms/LoopDistribute/disable_nonforced_enable.ll
@@ -1,17 +1,12 @@
-; RUN: opt -passes=loop-distribute -S < %s | FileCheck %s
+; RUN: opt -passes=loop-distribute -verify-loop-info -verify-dom-info -S < %s | FileCheck %s
;
; Check that llvm.loop.distribute.enable overrides
; llvm.loop.disable_nonforced.
;
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+define void @disable_nonforced(ptr noalias %a, ptr noalias %b, ptr noalias %c, ptr noalias %d, ptr noalias %e) {
; CHECK-LABEL: @disable_nonforced(
; CHECK: for.body.ldist1:
-define void @disable_nonforced(ptr noalias %a,
- ptr noalias %b,
- ptr noalias %c,
- ptr noalias %d,
- ptr noalias %e) {
entry:
br label %for.body
diff --git a/llvm/test/Transforms/LoopDistribute/early-exit.ll b/llvm/test/Transforms/LoopDistribute/early-exit.ll
index e04811335e1bd..9353d842523f4 100644
--- a/llvm/test/Transforms/LoopDistribute/early-exit.ll
+++ b/llvm/test/Transforms/LoopDistribute/early-exit.ll
@@ -1,10 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
-; REQUIRES: x86-registered-target
; RUN: opt -aa-pipeline=basic-aa -passes=loop-distribute -enable-loop-distribute -verify-loop-info -verify-dom-info -S %s | FileCheck %s
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.10.0"
-
@B = common global ptr null, align 8
@A = common global ptr null, align 8
@C = common global ptr null, align 8
diff --git a/llvm/test/Transforms/LoopDistribute/followup.ll b/llvm/test/Transforms/LoopDistribute/followup.ll
index 86cfb1855ae34..55307bdf24991 100644
--- a/llvm/test/Transforms/LoopDistribute/followup.ll
+++ b/llvm/test/Transforms/LoopDistribute/followup.ll
@@ -1,11 +1,93 @@
-; RUN: opt -passes=loop-distribute -S < %s | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -passes=loop-distribute -verify-loop-info -verify-dom-info -S < %s | FileCheck %s
;
; Check that followup loop-attributes are applied to the loops after
; loop distribution.
;
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
define void @f(ptr %a, ptr %b, ptr %c, ptr %d, ptr %e) {
+; CHECK-LABEL: define void @f(
+; CHECK-SAME: ptr [[A:%.*]], ptr [[B:%.*]], ptr [[C:%.*]], ptr [[D:%.*]], ptr [[E:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: br label %[[FOR_BODY_LVER_CHECK:.*]]
+; CHECK: [[FOR_BODY_LVER_CHECK]]:
+; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[A]], i64 84
+; CHECK-NEXT: [[SCEVGEP1:%.*]] = getelementptr i8, ptr [[C]], i64 80
+; CHECK-NEXT: [[SCEVGEP2:%.*]] = getelementptr i8, ptr [[D]], i64 80
+; CHECK-NEXT: [[SCEVGEP3:%.*]] = getelementptr i8, ptr [[E]], i64 80
+; CHECK-NEXT: [[SCEVGEP4:%.*]] = getelementptr i8, ptr [[B]], i64 80
+; CHECK-NEXT: [[BOUND0:%.*]] = icmp ult ptr [[A]], [[SCEVGEP1]]
+; CHECK-NEXT: [[BOUND1:%.*]] = icmp ult ptr [[C]], [[SCEVGEP]]
+; CHECK-NEXT: [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]]
+; CHECK-NEXT: [[BOUND05:%.*]] = icmp ult ptr [[A]], [[SCEVGEP2]]
+; CHECK-NEXT: [[BOUND16:%.*]] = icmp ult ptr [[D]], [[SCEVGEP]]
+; CHECK-NEXT: [[FOUND_CONFLICT7:%.*]] = and i1 [[BOUND05]], [[BOUND16]]
+; CHECK-NEXT: [[CONFLICT_RDX:%.*]] = or i1 [[FOUND_CONFLICT]], [[FOUND_CONFLICT7]]
+; CHECK-NEXT: [[BOUND08:%.*]] = icmp ult ptr [[A]], [[SCEVGEP3]]
+; CHECK-NEXT: [[BOUND19:%.*]] = icmp ult ptr [[E]], [[SCEVGEP]]
+; CHECK-NEXT: [[FOUND_CONFLICT10:%.*]] = and i1 [[BOUND08]], [[BOUND19]]
+; CHECK-NEXT: [[CONFLICT_RDX11:%.*]] = or i1 [[CONFLICT_RDX]], [[FOUND_CONFLICT10]]
+; CHECK-NEXT: [[BOUND012:%.*]] = icmp ult ptr [[C]], [[SCEVGEP4]]
+; CHECK-NEXT: [[BOUND113:%.*]] = icmp ult ptr [[B]], [[SCEVGEP1]]
+; CHECK-NEXT: [[FOUND_CONFLICT14:%.*]] = and i1 [[BOUND012]], [[BOUND113]]
+; CHECK-NEXT: [[CONFLICT_RDX15:%.*]] = or i1 [[CONFLICT_RDX11]], [[FOUND_CONFLICT14]]
+; CHECK-NEXT: br i1 [[CONFLICT_RDX15]], label %[[FOR_BODY_PH_LVER_ORIG:.*]], label %[[FOR_BODY_PH_LDIST1:.*]]
+; CHECK: [[FOR_BODY_PH_LVER_ORIG]]:
+; CHECK-NEXT: br label %[[FOR_BODY_LVER_ORIG:.*]]
+; CHECK: [[FOR_BODY_LVER_ORIG]]:
+; CHECK-NEXT: [[IND_LVER_ORIG:%.*]] = phi i64 [ 0, %[[FOR_BODY_PH_LVER_ORIG]] ], [ [[ADD_LVER_ORIG:%.*]], %[[FOR_BODY_LVER_ORIG]] ]
+; CHECK-NEXT: [[ARRAYIDXA_LVER_ORIG:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[IND_LVER_ORIG]]
+; CHECK-NEXT: [[LOADA_LVER_ORIG:%.*]] = load i32, ptr [[ARRAYIDXA_LVER_ORIG]], align 4
+; CHECK-NEXT: [[ARRAYIDXB_LVER_ORIG:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[IND_LVER_ORIG]]
+; CHECK-NEXT: [[LOADB_LVER_ORIG:%.*]] = load i32, ptr [[ARRAYIDXB_LVER_ORIG]], align 4
+; CHECK-NEXT: [[MULA_LVER_ORIG:%.*]] = mul i32 [[LOADB_LVER_ORIG]], [[LOADA_LVER_ORIG]]
+; CHECK-NEXT: [[ADD_LVER_ORIG]] = add nuw nsw i64 [[IND_LVER_ORIG]], 1
+; CHECK-NEXT: [[ARRAYIDXA_PLUS_4_LVER_ORIG:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[ADD_LVER_ORIG]]
+; CHECK-NEXT: store i32 [[MULA_LVER_ORIG]], ptr [[ARRAYIDXA_PLUS_4_LVER_ORIG]], align 4
+; CHECK-NEXT: [[ARRAYIDXD_LVER_ORIG:%.*]] = getelementptr inbounds i32, ptr [[D]], i64 [[IND_LVER_ORIG]]
+; CHECK-NEXT: [[LOADD_LVER_ORIG:%.*]] = load i32, ptr [[ARRAYIDXD_LVER_ORIG]], align 4
+; CHECK-NEXT: [[ARRAYIDXE_LVER_ORIG:%.*]] = getelementptr inbounds i32, ptr [[E]], i64 [[IND_LVER_ORIG]]
+; CHECK-NEXT: [[LOADE_LVER_ORIG:%.*]] = load i32, ptr [[ARRAYIDXE_LVER_ORIG]], align 4
+; CHECK-NEXT: [[MULC_LVER_ORIG:%.*]] = mul i32 [[LOADD_LVER_ORIG]], [[LOADE_LVER_ORIG]]
+; CHECK-NEXT: [[ARRAYIDXC_LVER_ORIG:%.*]] = getelementptr inbounds i32, ptr [[C]], i64 [[IND_LVER_ORIG]]
+; CHECK-NEXT: store i32 [[MULC_LVER_ORIG]], ptr [[ARRAYIDXC_LVER_ORIG]], align 4
+; CHECK-NEXT: [[EXITCOND_LVER_ORIG:%.*]] = icmp eq i64 [[ADD_LVER_ORIG]], 20
+; CHECK-NEXT: br i1 [[EXITCOND_LVER_ORIG]], label %[[FOR_END_LOOPEXIT:.*]], label %[[FOR_BODY_LVER_ORIG]], !llvm.loop [[LOOP0:![0-9]+]]
+; CHECK: [[FOR_BODY_PH_LDIST1]]:
+; CHECK-NEXT: br label %[[FOR_BODY_LDIST1:.*]]
+; CHECK: [[FOR_BODY_LDIST1]]:
+; CHECK-NEXT: [[IND_LDIST1:%.*]] = phi i64 [ 0, %[[FOR_BODY_PH_LDIST1]] ], [ [[ADD_LDIST1:%.*]], %[[FOR_BODY_LDIST1]] ]
+; CHECK-NEXT: [[ARRAYIDXA_LDIST1:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[IND_LDIST1]]
+; CHECK-NEXT: [[LOADA_LDIST1:%.*]] = load i32, ptr [[ARRAYIDXA_LDIST1]], align 4, !alias.scope [[META3:![0-9]+]], !noalias [[META6:![0-9]+]]
+; CHECK-NEXT: [[ARRAYIDXB_LDIST1:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[IND_LDIST1]]
+; CHECK-NEXT: [[LOADB_LDIST1:%.*]] = load i32, ptr [[ARRAYIDXB_LDIST1]], align 4, !alias.scope [[META10:![0-9]+]]
+; CHECK-NEXT: [[MULA_LDIST1:%.*]] = mul i32 [[LOADB_LDIST1]], [[LOADA_LDIST1]]
+; CHECK-NEXT: [[ADD_LDIST1]] = add nuw nsw i64 [[IND_LDIST1]], 1
+; CHECK-NEXT: [[ARRAYIDXA_PLUS_4_LDIST1:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[ADD_LDIST1]]
+; CHECK-NEXT: store i32 [[MULA_LDIST1]], ptr [[ARRAYIDXA_PLUS_4_LDIST1]], align 4, !alias.scope [[META3]], !noalias [[META6]]
+; CHECK-NEXT: [[EXITCOND_LDIST1:%.*]] = icmp eq i64 [[ADD_LDIST1]], 20
+; CHECK-NEXT: br i1 [[EXITCOND_LDIST1]], label %[[FOR_BODY_PH:.*]], label %[[FOR_BODY_LDIST1]], !llvm.loop [[LOOP12:![0-9]+]]
+; CHECK: [[FOR_BODY_PH]]:
+; CHECK-NEXT: br label %[[FOR_BODY:.*]]
+; CHECK: [[FOR_BODY]]:
+; CHECK-NEXT: [[IND:%.*]] = phi i64 [ 0, %[[FOR_BODY_PH]] ], [ [[ADD:%.*]], %[[FOR_BODY]] ]
+; CHECK-NEXT: [[ADD]] = add nuw nsw i64 [[IND]], 1
+; CHECK-NEXT: [[ARRAYIDXD:%.*]] = getelementptr inbounds i32, ptr [[D]], i64 [[IND]]
+; CHECK-NEXT: [[LOADD:%.*]] = load i32, ptr [[ARRAYIDXD]], align 4, !alias.scope [[META14:![0-9]+]]
+; CHECK-NEXT: [[ARRAYIDXE:%.*]] = getelementptr inbounds i32, ptr [[E]], i64 [[IND]]
+; CHECK-NEXT: [[LOADE:%.*]] = load i32, ptr [[ARRAYIDXE]], align 4, !alias.scope [[META15:![0-9]+]]
+; CHECK-NEXT: [[MULC:%.*]] = mul i32 [[LOADD]], [[LOADE]]
+; CHECK-NEXT: [[ARRAYIDXC:%.*]] = getelementptr inbounds i32, ptr [[C]], i64 [[IND]]
+; CHECK-NEXT: store i32 [[MULC]], ptr [[ARRAYIDXC]], align 4, !alias.scope [[META16:![0-9]+]], !noalias [[META10]]
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[ADD]], 20
+; CHECK-NEXT: br i1 [[EXITCOND]], label %[[FOR_END_LOOPEXIT16:.*]], label %[[FOR_BODY]], !llvm.loop [[LOOP17:![0-9]+]]
+; CHECK: [[FOR_END_LOOPEXIT]]:
+; CHECK-NEXT: br label %[[FOR_END:.*]]
+; CHECK: [[FOR_END_LOOPEXIT16]]:
+; CHECK-NEXT: br label %[[FOR_END]]
+; CHECK: [[FOR_END]]:
+; CHECK-NEXT: ret void
+;
entry:
br label %for.body
@@ -48,23 +130,24 @@ for.end:
!3 = !{!"llvm.loop.distribute.followup_coincident", !{!"FollowupCoincident", i1 false}}
!4 = !{!"llvm.loop.distribute.followup_sequential", !{!"FollowupSequential", i32 8}}
!5 = !{!"llvm.loop.distribute.followup_fallback", !{!"FollowupFallback"}}
-
-
-; CHECK-LABEL: for.body.lver.orig:
-; CHECK: br i1 %exitcond.lver.orig, label %for.end.loopexit, label %for.body.lver.orig, !llvm.loop ![[LOOP_ORIG:[0-9]+]]
-; CHECK-LABEL: for.body.ldist1:
-; CHECK: br i1 %exitcond.ldist1, label %for.body.ph, label %for.body.ldist1, !llvm.loop ![[LOOP_SEQUENTIAL:[0-9]+]]
-; CHECK-LABEL: for.body:
-; CHECK: br i1 %exitcond, label %for.end.loopexit16, label %for.body, !llvm.loop ![[LOOP_COINCIDENT:[0-9]+]]
-; CHECK-LABEL: for.end.loopexit:
-; CHECK: br label %for.end
-; CHECK-LABEL: for.end.loopexit16:
-; CHECK: br label %for.end
-
-; CHECK: ![[LOOP_ORIG]] = distinct !{![[LOOP_ORIG]], ![[FOLLOWUP_ALL:[0-9]+]], ![[FOLLOUP_FALLBACK:[0-9]+]]}
-; CHECK: ![[FOLLOWUP_ALL]] = !{!"FollowupAll"}
-; CHECK: ![[FOLLOUP_FALLBACK]] = !{!"FollowupFallback"}
-; CHECK: ![[LOOP_SEQUENTIAL]] = distinct !{![[LOOP_SEQUENTIAL]], ![[FOLLOWUP_ALL]], ![[FOLLOWUP_SEQUENTIAL:[0-9]+]]}
-; CHECK: ![[FOLLOWUP_SEQUENTIAL]] = !{!"FollowupSequential", i32 8}
-; CHECK: ![[LOOP_COINCIDENT]] = distinct !{![[LOOP_COINCIDENT]], ![[FOLLOWUP_ALL]], ![[FOLLOWUP_COINCIDENT:[0-9]+]]}
-; CHECK: ![[FOLLOWUP_COINCIDENT]] = !{!"FollowupCoincident", i1 false}
+;.
+; CHECK: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]]}
+; CHECK: [[META1]] = !{!"FollowupAll"}
+; CHECK: [[META2]] = !{!"FollowupFallback"}
+; CHECK: [[META3]] = !{[[META4:![0-9]+]]}
+; CHECK: [[META4]] = distinct !{[[META4]], [[META5:![0-9]+]]}
+; CHECK: [[META5]] = distinct !{[[META5]], !"LVerDomain"}
+; CHECK: [[META6]] = !{[[META7:![0-9]+]], [[META8:![0-9]+]], [[META9:![0-9]+]]}
+; CHECK: [[META7]] = distinct !{[[META7]], [[META5]]}
+; CHECK: [[META8]] = distinct !{[[META8]], [[META5]]}
+; CHECK: [[META9]] = distinct !{[[META9]], [[META5]]}
+; CHECK: [[META10]] = !{[[META11:![0-9]+]]}
+; CHECK: [[META11]] = distinct !{[[META11]], [[META5]]}
+; CHECK: [[LOOP12]] = distinct !{[[LOOP12]], [[META1]], [[META13:![0-9]+]]}
+; CHECK: [[META13]] = !{!"FollowupSequential", i32 8}
+; CHECK: [[META14]] = !{[[META8]]}
+; CHECK: [[META15]] = !{[[META9]]}
+; CHECK: [[META16]] = !{[[META7]]}
+; CHECK: [[LOOP17]] = distinct !{[[LOOP17]], [[META1]], [[META18:![0-9]+]]}
+; CHECK: [[META18]] = !{!"FollowupCoincident", i1 false}
+;.
diff --git a/llvm/test/Transforms/LoopDistribute/metadata.ll b/llvm/test/Transforms/LoopDistribute/metadata.ll
index 7cd0415ec52c1..b0e461fe0ea75 100644
--- a/llvm/test/Transforms/LoopDistribute/metadata.ll
+++ b/llvm/test/Transforms/LoopDistribute/metadata.ll
@@ -5,20 +5,12 @@
; properly according to -enable-loop-distribute=0/1 and the
; llvm.loop.distribute.enable metadata.
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.10.0"
-
+define void @explicit_on(ptr noalias %a, ptr noalias %b, ptr noalias %c, ptr noalias %d, ptr noalias %e) {
; CHECK-LABEL: @explicit_on(
-define void @explicit_on(ptr noalias %a,
- ptr noalias %b,
- ptr noalias %c,
- ptr noalias %d,
- ptr noalias %e) {
entry:
br label %for.body
; EXPLICIT: for.body.ldist1:
-
for.body: ; preds = %for.body, %entry
%ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
@@ -62,7 +54,6 @@ entry:
br label %for.body
; EXPLICIT-NOT: for.body.ldist1:
-
for.body: ; preds = %for.body, %entry
%ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
@@ -96,12 +87,9 @@ for.end: ; preds = %for.body
ret void
}
-; CHECK-LABEL: @default_distribute(
-define void @default_distribute(ptr noalias %a,
- ptr noalias %b,
- ptr noalias %c,
- ptr noalias %d,
+define void @default_distribute(ptr noalias %a, ptr noalias %b, ptr noalias %c, ptr noalias %d,
ptr noalias %e) {
+; CHECK-LABEL: @default_distribute(
entry:
br label %for.body
@@ -109,7 +97,6 @@ entry:
; DEFAULT_ON: for.body.ldist1:
; DEFAULT_OFF-NOT: for.body.ldist1:
-
for.body: ; preds = %for.body, %entry
%ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
diff --git a/llvm/test/Transforms/LoopDistribute/no-if-convert.ll b/llvm/test/Transforms/LoopDistribute/no-if-convert.ll
index 77e120e346247..35a340e32b1ae 100644
--- a/llvm/test/Transforms/LoopDistribute/no-if-convert.ll
+++ b/llvm/test/Transforms/LoopDistribute/no-if-convert.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -passes=loop-distribute -enable-loop-distribute -verify-loop-info -verify-dom-info -S < %s \
; RUN: | FileCheck %s
@@ -15,33 +16,63 @@
; G[i] = H[i] * J[i];
; }
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.10.0"
-
-define void @f(ptr noalias %a,
- ptr noalias %b,
- ptr noalias %c,
- ptr noalias %d,
- ptr noalias %e,
- ptr noalias %g,
- ptr noalias %h,
- ptr noalias %j,
- i64 %x) {
-entry:
- br label %for.body
-
; Ensure that we have only two partitions, the first with one multiplication
; and the second with two.
-
-; CHECK: for.body.ldist1:
-; CHECK: %mulC.ldist1 = mul i32 %loadD.ldist1, %loadE.ldist1
-; CHECK: br i1 %exitcond.ldist1, label %entry.split, label %for.body.ldist1
-; CHECK: entry.split:
-; CHECK: br label %for.body
-; CHECK: for.body:
-; CHECK: %mulA = mul i32 %loadB, %loadA
-; CHECK: %mulG = mul i32 %loadH, %loadJ
-; CHECK: for.end:
+define void @f(ptr noalias %a, ptr noalias %b, ptr noalias %c, ptr noalias %d, ptr noalias %e, ptr noalias %g, ptr noalias %h, ptr noalias %j, i64 %x) {
+; CHECK-LABEL: define void @f(
+; CHECK-SAME: ptr noalias [[A:%.*]], ptr noalias [[B:%.*]], ptr noalias [[C:%.*]], ptr noalias [[D:%.*]], ptr noalias [[E:%.*]], ptr noalias [[G:%.*]], ptr noalias [[H:%.*]], ptr noalias [[J:%.*]], i64 [[X:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: br label %[[ENTRY_SPLIT_LDIST1:.*]]
+; CHECK: [[ENTRY_SPLIT_LDIST1]]:
+; CHECK-NEXT: br label %[[FOR_BODY_LDIST1:.*]]
+; CHECK: [[FOR_BODY_LDIST1]]:
+; CHECK-NEXT: [[IND_LDIST1:%.*]] = phi i64 [ 0, %[[ENTRY_SPLIT_LDIST1]] ], [ [[ADD_LDIST1:%.*]], %[[IF_END_LDIST1:.*]] ]
+; CHECK-NEXT: [[ARRAYIDXD_LDIST1:%.*]] = getelementptr inbounds i32, ptr [[D]], i64 [[IND_LDIST1]]
+; CHECK-NEXT: [[LOADD_LDIST1:%.*]] = load i32, ptr [[ARRAYIDXD_LDIST1]], align 4
+; CHECK-NEXT: [[ARRAYIDXE_LDIST1:%.*]] = getelementptr inbounds i32, ptr [[E]], i64 [[IND_LDIST1]]
+; CHECK-NEXT: [[LOADE_LDIST1:%.*]] = load i32, ptr [[ARRAYIDXE_LDIST1]], align 4
+; CHECK-NEXT: [[MULC_LDIST1:%.*]] = mul i32 [[LOADD_LDIST1]], [[LOADE_LDIST1]]
+; CHECK-NEXT: [[ARRAYIDXC_LDIST1:%.*]] = getelementptr inbounds i32, ptr [[C]], i64 [[IND_LDIST1]]
+; CHECK-NEXT: store i32 [[MULC_LDIST1]], ptr [[ARRAYIDXC_LDIST1]], align 4
+; CHECK-NEXT: [[ADD_LDIST1]] = add nuw nsw i64 [[IND_LDIST1]], 1
+; CHECK-NEXT: [[IF_COND_LDIST1:%.*]] = icmp eq i64 [[IND_LDIST1]], [[X]]
+; CHECK-NEXT: br i1 [[IF_COND_LDIST1]], label %[[IF_THEN_LDIST1:.*]], label %[[IF_END_LDIST1]]
+; CHECK: [[IF_THEN_LDIST1]]:
+; CHECK-NEXT: br label %[[IF_END_LDIST1]]
+; CHECK: [[IF_END_LDIST1]]:
+; CHECK-NEXT: [[EXITCOND_LDIST1:%.*]] = icmp eq i64 [[ADD_LDIST1]], 20
+; CHECK-NEXT: br i1 [[EXITCOND_LDIST1]], label %[[ENTRY_SPLIT:.*]], label %[[FOR_BODY_LDIST1]]
+; CHECK: [[ENTRY_SPLIT]]:
+; CHECK-NEXT: br label %[[FOR_BODY:.*]]
+; CHECK: [[FOR_BODY]]:
+; CHECK-NEXT: [[IND:%.*]] = phi i64 [ 0, %[[ENTRY_SPLIT]] ], [ [[ADD:%.*]], %[[IF_END:.*]] ]
+; CHECK-NEXT: [[ARRAYIDXA:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[IND]]
+; CHECK-NEXT: [[LOADA:%.*]] = load i32, ptr [[ARRAYIDXA]], align 4
+; CHECK-NEXT: [[ARRAYIDXB:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[IND]]
+; CHECK-NEXT: [[LOADB:%.*]] = load i32, ptr [[ARRAYIDXB]], align 4
+; CHECK-NEXT: [[MULA:%.*]] = mul i32 [[LOADB]], [[LOADA]]
+; CHECK-NEXT: [[ADD]] = add nuw nsw i64 [[IND]], 1
+; CHECK-NEXT: [[ARRAYIDXA_PLUS_4:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[ADD]]
+; CHECK-NEXT: store i32 [[MULA]], ptr [[ARRAYIDXA_PLUS_4]], align 4
+; CHECK-NEXT: [[IF_COND:%.*]] = icmp eq i64 [[IND]], [[X]]
+; CHECK-NEXT: br i1 [[IF_COND]], label %[[IF_THEN:.*]], label %[[IF_END]]
+; CHECK: [[IF_THEN]]:
+; CHECK-NEXT: [[ARRAYIDXH:%.*]] = getelementptr inbounds i32, ptr [[H]], i64 [[IND]]
+; CHECK-NEXT: [[LOADH:%.*]] = load i32, ptr [[ARRAYIDXH]], align 4
+; CHECK-NEXT: [[ARRAYIDXJ:%.*]] = getelementptr inbounds i32, ptr [[J]], i64 [[IND]]
+; CHECK-NEXT: [[LOADJ:%.*]] = load i32, ptr [[ARRAYIDXJ]], align 4
+; CHECK-NEXT: [[MULG:%.*]] = mul i32 [[LOADH]], [[LOADJ]]
+; CHECK-NEXT: [[ARRAYIDXG:%.*]] = getelementptr inbounds i32, ptr [[G]], i64 [[IND]]
+; CHECK-NEXT: store i32 [[MULG]], ptr [[ARRAYIDXG]], align 4
+; CHECK-NEXT: br label %[[IF_END]]
+; CHECK: [[IF_END]]:
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[ADD]], 20
+; CHECK-NEXT: br i1 [[EXITCOND]], label %[[FOR_END:.*]], label %[[FOR_BODY]]
+; CHECK: [[FOR_END]]:
+; CHECK-NEXT: ret void
+;
+entry:
+ br label %for.body
for.body: ; preds = %for.body, %entry
%ind = phi i64 [ 0, %entry ], [ %add, %if.end ]
diff --git a/llvm/test/Transforms/LoopDistribute/outside-use.ll b/llvm/test/Transforms/LoopDistribute/outside-use.ll
index e564c445fc6b9..661f8062ae268 100644
--- a/llvm/test/Transforms/LoopDistribute/outside-use.ll
+++ b/llvm/test/Transforms/LoopDistribute/outside-use.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -passes=loop-distribute -enable-loop-distribute -verify-loop-info -verify-dom-info -S < %s \
; RUN: | FileCheck %s
@@ -11,9 +12,6 @@
; sum += C[i];
; }
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.10.0"
-
@B = common global ptr null, align 8
@A = common global ptr null, align 8
@C = common global ptr null, align 8
@@ -22,6 +20,75 @@ target triple = "x86_64-apple-macosx10.10.0"
@SUM = common global i32 0, align 8
define void @f() {
+; CHECK-LABEL: define void @f() {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: [[A:%.*]] = load ptr, ptr @A, align 8
+; CHECK-NEXT: [[B:%.*]] = load ptr, ptr @B, align 8
+; CHECK-NEXT: [[C:%.*]] = load ptr, ptr @C, align 8
+; CHECK-NEXT: [[D:%.*]] = load ptr, ptr @D, align 8
+; CHECK-NEXT: [[E:%.*]] = load ptr, ptr @E, align 8
+; CHECK-NEXT: br label %[[FOR_BODY_LVER_CHECK:.*]]
+; CHECK: [[FOR_BODY_LVER_CHECK]]:
+; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[A]], i64 84
+; CHECK-NEXT: [[SCEVGEP1:%.*]] = getelementptr i8, ptr [[C]], i64 80
+; CHECK-NEXT: [[BOUND0:%.*]] = icmp ult ptr [[A]], [[SCEVGEP1]]
+; CHECK-NEXT: [[BOUND1:%.*]] = icmp ult ptr [[C]], [[SCEVGEP]]
+; CHECK-NEXT: [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]]
+; CHECK-NEXT: br i1 [[FOUND_CONFLICT]], label %[[FOR_BODY_PH_LVER_ORIG:.*]], label %[[FOR_BODY_PH_LDIST1:.*]]
+; CHECK: [[FOR_BODY_PH_LVER_ORIG]]:
+; CHECK-NEXT: br label %[[FOR_BODY_LVER_ORIG:.*]]
+; CHECK: [[FOR_BODY_LVER_ORIG]]:
+; CHECK-NEXT: [[IND_LVER_ORIG:%.*]] = phi i64 [ 0, %[[FOR_BODY_PH_LVER_ORIG]] ], [ [[ADD_LVER_ORIG:%.*]], %[[FOR_BODY_LVER_ORIG]] ]
+; CHECK-NEXT: [[SUM_LVER_ORIG:%.*]] = phi i32 [ 0, %[[FOR_BODY_PH_LVER_ORIG]] ], [ [[SUM_ADD_LVER_ORIG:%.*]], %[[FOR_BODY_LVER_ORIG]] ]
+; CHECK-NEXT: [[ARRAYIDXA_LVER_ORIG:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[IND_LVER_ORIG]]
+; CHECK-NEXT: [[LOADA_LVER_ORIG:%.*]] = load i32, ptr [[ARRAYIDXA_LVER_ORIG]], align 4
+; CHECK-NEXT: [[ARRAYIDXB_LVER_ORIG:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[IND_LVER_ORIG]]
+; CHECK-NEXT: [[LOADB_LVER_ORIG:%.*]] = load i32, ptr [[ARRAYIDXB_LVER_ORIG]], align 4
+; CHECK-NEXT: [[MULA_LVER_ORIG:%.*]] = mul i32 [[LOADB_LVER_ORIG]], [[LOADA_LVER_ORIG]]
+; CHECK-NEXT: [[ADD_LVER_ORIG]] = add nuw nsw i64 [[IND_LVER_ORIG]], 1
+; CHECK-NEXT: [[ARRAYIDXA_PLUS_4_LVER_ORIG:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[ADD_LVER_ORIG]]
+; CHECK-NEXT: store i32 [[MULA_LVER_ORIG]], ptr [[ARRAYIDXA_PLUS_4_LVER_ORIG]], align 4
+; CHECK-NEXT: [[ARRAYIDXC_LVER_ORIG:%.*]] = getelementptr inbounds i32, ptr [[C]], i64 [[IND_LVER_ORIG]]
+; CHECK-NEXT: [[LOADC_LVER_ORIG:%.*]] = load i32, ptr [[ARRAYIDXC_LVER_ORIG]], align 4
+; CHECK-NEXT: [[SUM_ADD_LVER_ORIG]] = add nuw nsw i32 [[SUM_LVER_ORIG]], [[LOADC_LVER_ORIG]]
+; CHECK-NEXT: [[EXITCOND_LVER_ORIG:%.*]] = icmp eq i64 [[ADD_LVER_ORIG]], 20
+; CHECK-NEXT: br i1 [[EXITCOND_LVER_ORIG]], label %[[FOR_END_LOOPEXIT:.*]], label %[[FOR_BODY_LVER_ORIG]]
+; CHECK: [[FOR_BODY_PH_LDIST1]]:
+; CHECK-NEXT: br label %[[FOR_BODY_LDIST1:.*]]
+; CHECK: [[FOR_BODY_LDIST1]]:
+; CHECK-NEXT: [[IND_LDIST1:%.*]] = phi i64 [ 0, %[[FOR_BODY_PH_LDIST1]] ], [ [[ADD_LDIST1:%.*]], %[[FOR_BODY_LDIST1]] ]
+; CHECK-NEXT: [[ARRAYIDXA_LDIST1:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[IND_LDIST1]]
+; CHECK-NEXT: [[LOADA_LDIST1:%.*]] = load i32, ptr [[ARRAYIDXA_LDIST1]], align 4, !alias.scope [[META0:![0-9]+]], !noalias [[META3:![0-9]+]]
+; CHECK-NEXT: [[ARRAYIDXB_LDIST1:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[IND_LDIST1]]
+; CHECK-NEXT: [[LOADB_LDIST1:%.*]] = load i32, ptr [[ARRAYIDXB_LDIST1]], align 4, !alias.scope [[META5:![0-9]+]]
+; CHECK-NEXT: [[MULA_LDIST1:%.*]] = mul i32 [[LOADB_LDIST1]], [[LOADA_LDIST1]]
+; CHECK-NEXT: [[ADD_LDIST1]] = add nuw nsw i64 [[IND_LDIST1]], 1
+; CHECK-NEXT: [[ARRAYIDXA_PLUS_4_LDIST1:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[ADD_LDIST1]]
+; CHECK-NEXT: store i32 [[MULA_LDIST1]], ptr [[ARRAYIDXA_PLUS_4_LDIST1]], align 4, !alias.scope [[META0]], !noalias [[META3]]
+; CHECK-NEXT: [[EXITCOND_LDIST1:%.*]] = icmp eq i64 [[ADD_LDIST1]], 20
+; CHECK-NEXT: br i1 [[EXITCOND_LDIST1]], label %[[FOR_BODY_PH:.*]], label %[[FOR_BODY_LDIST1]]
+; CHECK: [[FOR_BODY_PH]]:
+; CHECK-NEXT: br label %[[FOR_BODY:.*]]
+; CHECK: [[FOR_BODY]]:
+; CHECK-NEXT: [[IND:%.*]] = phi i64 [ 0, %[[FOR_BODY_PH]] ], [ [[ADD:%.*]], %[[FOR_BODY]] ]
+; CHECK-NEXT: [[SUM:%.*]] = phi i32 [ 0, %[[FOR_BODY_PH]] ], [ [[SUM_ADD:%.*]], %[[FOR_BODY]] ]
+; CHECK-NEXT: [[ADD]] = add nuw nsw i64 [[IND]], 1
+; CHECK-NEXT: [[ARRAYIDXC:%.*]] = getelementptr inbounds i32, ptr [[C]], i64 [[IND]]
+; CHECK-NEXT: [[LOADC:%.*]] = load i32, ptr [[ARRAYIDXC]], align 4, !alias.scope [[META3]]
+; CHECK-NEXT: [[SUM_ADD]] = add nuw nsw i32 [[SUM]], [[LOADC]]
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[ADD]], 20
+; CHECK-NEXT: br i1 [[EXITCOND]], label %[[FOR_END_LOOPEXIT2:.*]], label %[[FOR_BODY]]
+; CHECK: [[FOR_END_LOOPEXIT]]:
+; CHECK-NEXT: [[SUM_ADD_LVER_PH:%.*]] = phi i32 [ [[SUM_ADD_LVER_ORIG]], %[[FOR_BODY_LVER_ORIG]] ]
+; CHECK-NEXT: br label %[[FOR_END:.*]]
+; CHECK: [[FOR_END_LOOPEXIT2]]:
+; CHECK-NEXT: [[SUM_ADD_LVER_PH3:%.*]] = phi i32 [ [[SUM_ADD]], %[[FOR_BODY]] ]
+; CHECK-NEXT: br label %[[FOR_END]]
+; CHECK: [[FOR_END]]:
+; CHECK-NEXT: [[SUM_ADD_LVER:%.*]] = phi i32 [ [[SUM_ADD_LVER_PH]], %[[FOR_END_LOOPEXIT]] ], [ [[SUM_ADD_LVER_PH3]], %[[FOR_END_LOOPEXIT2]] ]
+; CHECK-NEXT: store i32 [[SUM_ADD_LVER]], ptr @SUM, align 4
+; CHECK-NEXT: ret void
+;
entry:
%a = load ptr, ptr @A, align 8
%b = load ptr, ptr @B, align 8
@@ -31,18 +98,6 @@ entry:
br label %for.body
-; CHECK: for.body.ldist1:
-; CHECK: %mulA.ldist1 = mul i32 %loadB.ldist1, %loadA.ldist1
-; CHECK: for.body.ph:
-; CHECK: for.body:
-; CHECK: %sum_add = add nuw nsw i32 %sum, %loadC
-; CHECK: for.end.loopexit:
-; CHECK: %sum_add.lver.ph = phi i32 [ %sum_add.lver.orig, %for.body.lver.orig ]
-; CHECK: for.end.loopexit2:
-; CHECK: %sum_add.lver.ph3 = phi i32 [ %sum_add, %for.body ]
-; CHECK: for.end:
-; CHECK: %sum_add.lver = phi i32 [ %sum_add.lver.ph, %for.end.loopexit ], [ %sum_add.lver.ph3, %for.end.loopexit2 ]
-
for.body: ; preds = %for.body, %entry
%ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
%sum = phi i32 [ 0, %entry ], [ %sum_add, %for.body ]
@@ -71,3 +126,12 @@ for.end: ; preds = %for.body
store i32 %sum_add, ptr @SUM, align 4
ret void
}
+;.
+; CHECK: [[META0]] = !{[[META1:![0-9]+]]}
+; CHECK: [[META1]] = distinct !{[[META1]], [[META2:![0-9]+]]}
+; CHECK: [[META2]] = distinct !{[[META2]], !"LVerDomain"}
+; CHECK: [[META3]] = !{[[META4:![0-9]+]]}
+; CHECK: [[META4]] = distinct !{[[META4]], [[META2]]}
+; CHECK: [[META5]] = !{[[META6:![0-9]+]]}
+; CHECK: [[META6]] = distinct !{[[META6]], [[META2]]}
+;.
diff --git a/llvm/test/Transforms/LoopDistribute/pointer-phi-in-loop.ll b/llvm/test/Transforms/LoopDistribute/pointer-phi-in-loop.ll
index d99c6969ab273..2ab9140baf866 100644
--- a/llvm/test/Transforms/LoopDistribute/pointer-phi-in-loop.ll
+++ b/llvm/test/Transforms/LoopDistribute/pointer-phi-in-loop.ll
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -aa-pipeline=basic-aa -passes='loop-distribute' -enable-loop-distribute -S %s | FileCheck %s
+; RUN: opt -aa-pipeline=basic-aa -passes=loop-distribute -enable-loop-distribute -verify-loop-info -verify-dom-info -S %s | FileCheck %s
; Testcases inspired by PR50296, PR50288.
@@ -52,9 +52,69 @@ for.end.loopexit: ; preds = %if.end
ret void
}
-define void @phi_load_distribute(i1 %c, ptr %A, ptr %B, ptr %C) {
+define void @phi_load_distribute(i1 %cond, ptr %A, ptr %B, ptr %C) {
; CHECK-LABEL: @phi_load_distribute(
; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[FOR_BODY_LVER_CHECK:%.*]]
+; CHECK: for.body.lver.check:
+; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[A:%.*]], i64 2
+; CHECK-NEXT: [[SCEVGEP1:%.*]] = getelementptr i8, ptr [[C:%.*]], i64 2
+; CHECK-NEXT: [[SCEVGEP2:%.*]] = getelementptr i8, ptr [[B:%.*]], i64 2
+; CHECK-NEXT: [[BOUND0:%.*]] = icmp ult ptr [[A]], [[SCEVGEP1]]
+; CHECK-NEXT: [[BOUND1:%.*]] = icmp ult ptr [[C]], [[SCEVGEP]]
+; CHECK-NEXT: [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]]
+; CHECK-NEXT: [[BOUND03:%.*]] = icmp ult ptr [[A]], [[SCEVGEP2]]
+; CHECK-NEXT: [[BOUND14:%.*]] = icmp ult ptr [[B]], [[SCEVGEP]]
+; CHECK-NEXT: [[FOUND_CONFLICT5:%.*]] = and i1 [[BOUND03]], [[BOUND14]]
+; CHECK-NEXT: [[CONFLICT_RDX:%.*]] = or i1 [[FOUND_CONFLICT]], [[FOUND_CONFLICT5]]
+; CHECK-NEXT: br i1 [[CONFLICT_RDX]], label [[FOR_BODY_PH_LVER_ORIG:%.*]], label [[FOR_BODY_PH_LDIST1:%.*]]
+; CHECK: for.body.ph.lver.orig:
+; CHECK-NEXT: br label [[FOR_BODY_LVER_ORIG:%.*]]
+; CHECK: for.body.lver.orig:
+; CHECK-NEXT: [[IV_LVER_ORIG:%.*]] = phi i16 [ 0, [[FOR_BODY_PH_LVER_ORIG]] ], [ [[IV_NEXT_LVER_ORIG:%.*]], [[IF_END_LVER_ORIG:%.*]] ]
+; CHECK-NEXT: [[LV_LVER_ORIG:%.*]] = load i16, ptr [[A]], align 1
+; CHECK-NEXT: store i16 [[LV_LVER_ORIG]], ptr [[A]], align 1
+; CHECK-NEXT: br i1 [[COND:%.*]], label [[IF_THEN_LVER_ORIG:%.*]], label [[IF_END_LVER_ORIG]]
+; CHECK: if.then.lver.orig:
+; CHECK-NEXT: [[LV2_LVER_ORIG:%.*]] = load i16, ptr [[A]], align 1
+; CHECK-NEXT: br label [[IF_END_LVER_ORIG]]
+; CHECK: if.end.lver.orig:
+; CHECK-NEXT: [[C_SINK_LVER_ORIG:%.*]] = phi ptr [ [[B]], [[IF_THEN_LVER_ORIG]] ], [ [[C]], [[FOR_BODY_LVER_ORIG]] ]
+; CHECK-NEXT: [[LV3_LVER_ORIG:%.*]] = load i16, ptr [[C_SINK_LVER_ORIG]], align 2
+; CHECK-NEXT: [[IV_NEXT_LVER_ORIG]] = add nuw nsw i16 [[IV_LVER_ORIG]], 1
+; CHECK-NEXT: [[TOBOOL_NOT_LVER_ORIG:%.*]] = icmp eq i16 [[IV_NEXT_LVER_ORIG]], 1000
+; CHECK-NEXT: br i1 [[TOBOOL_NOT_LVER_ORIG]], label [[FOR_END_LOOPEXIT_LOOPEXIT:%.*]], label [[FOR_BODY_LVER_ORIG]]
+; CHECK: for.body.ph.ldist1:
+; CHECK-NEXT: br label [[FOR_BODY_LDIST1:%.*]]
+; CHECK: for.body.ldist1:
+; CHECK-NEXT: [[IV_LDIST1:%.*]] = phi i16 [ 0, [[FOR_BODY_PH_LDIST1]] ], [ [[IV_NEXT_LDIST1:%.*]], [[IF_END_LDIST1:%.*]] ]
+; CHECK-NEXT: [[LV_LDIST1:%.*]] = load i16, ptr [[A]], align 1, !alias.scope [[META0:![0-9]+]], !noalias [[META3:![0-9]+]]
+; CHECK-NEXT: store i16 [[LV_LDIST1]], ptr [[A]], align 1, !alias.scope [[META0]], !noalias [[META3]]
+; CHECK-NEXT: br i1 [[COND]], label [[IF_THEN_LDIST1:%.*]], label [[IF_END_LDIST1]]
+; CHECK: if.then.ldist1:
+; CHECK-NEXT: [[LV2_LDIST1:%.*]] = load i16, ptr [[A]], align 1, !alias.scope [[META0]], !noalias [[META3]]
+; CHECK-NEXT: br label [[IF_END_LDIST1]]
+; CHECK: if.end.ldist1:
+; CHECK-NEXT: [[IV_NEXT_LDIST1]] = add nuw nsw i16 [[IV_LDIST1]], 1
+; CHECK-NEXT: [[TOBOOL_NOT_LDIST1:%.*]] = icmp eq i16 [[IV_NEXT_LDIST1]], 1000
+; CHECK-NEXT: br i1 [[TOBOOL_NOT_LDIST1]], label [[FOR_BODY_PH:%.*]], label [[FOR_BODY_LDIST1]]
+; CHECK: for.body.ph:
+; CHECK-NEXT: br label [[FOR_BODY:%.*]]
+; CHECK: for.body:
+; CHECK-NEXT: [[IV:%.*]] = phi i16 [ 0, [[FOR_BODY_PH]] ], [ [[IV_NEXT:%.*]], [[IF_END:%.*]] ]
+; CHECK-NEXT: br i1 [[COND]], label [[IF_THEN:%.*]], label [[IF_END]]
+; CHECK: if.then:
+; CHECK-NEXT: br label [[IF_END]]
+; CHECK: if.end:
+; CHECK-NEXT: [[C_SINK:%.*]] = phi ptr [ [[B]], [[IF_THEN]] ], [ [[C]], [[FOR_BODY]] ]
+; CHECK-NEXT: [[LV3:%.*]] = load i16, ptr [[C_SINK]], align 2
+; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i16 [[IV]], 1
+; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i16 [[IV_NEXT]], 1000
+; CHECK-NEXT: br i1 [[TOBOOL_NOT]], label [[FOR_END_LOOPEXIT_LOOPEXIT6:%.*]], label [[FOR_BODY]]
+; CHECK: for.end.loopexit.loopexit:
+; CHECK-NEXT: br label [[FOR_END_LOOPEXIT:%.*]]
+; CHECK: for.end.loopexit.loopexit6:
+; CHECK-NEXT: br label [[FOR_END_LOOPEXIT]]
; CHECK: for.end.loopexit:
; CHECK-NEXT: ret void
;
@@ -65,7 +125,7 @@ for.body: ; preds = %if.end, %entry
%iv = phi i16 [ 0, %entry ], [ %iv.next, %if.end ]
%lv = load i16, ptr %A, align 1
store i16 %lv, ptr %A, align 1
- br i1 %c, label %if.then, label %if.end
+ br i1 %cond, label %if.then, label %if.end
if.then: ; preds = %for.body
%lv2 = load i16, ptr %A, align 1
diff --git a/llvm/test/Transforms/LoopDistribute/pr28443.ll b/llvm/test/Transforms/LoopDistribute/pr28443.ll
index 15908dc1fc6f4..dee448fe7d6a9 100644
--- a/llvm/test/Transforms/LoopDistribute/pr28443.ll
+++ b/llvm/test/Transforms/LoopDistribute/pr28443.ll
@@ -1,10 +1,26 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -passes=loop-distribute -enable-loop-distribute -verify-loop-info -verify-dom-info -S \
; RUN: < %s | FileCheck %s
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
define void @fn1(i64 %a, ptr %b) {
+; CHECK-LABEL: define void @fn1(
+; CHECK-SAME: i64 [[A:%.*]], ptr [[B:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: br label %[[FOR_BODY:.*]]
+; CHECK: [[FOR_BODY]]:
+; CHECK-NEXT: [[ADD75_EPIL:%.*]] = phi i64 [ [[ADD7_EPIL:%.*]], %[[FOR_BODY]] ], [ [[A]], %[[ENTRY]] ]
+; CHECK-NEXT: [[ADD1_EPIL:%.*]] = add nsw i64 [[ADD75_EPIL]], 268435457
+; CHECK-NEXT: [[ARRAYIDX_EPIL:%.*]] = getelementptr inbounds i64, ptr [[B]], i64 [[ADD1_EPIL]]
+; CHECK-NEXT: [[LOAD:%.*]] = load i64, ptr [[ARRAYIDX_EPIL]], align 8
+; CHECK-NEXT: [[ADD5_EPIL:%.*]] = add nsw i64 [[ADD75_EPIL]], 805306369
+; CHECK-NEXT: [[ARRAYIDX6_EPIL:%.*]] = getelementptr inbounds i64, ptr [[B]], i64 [[ADD5_EPIL]]
+; CHECK-NEXT: store i64 [[LOAD]], ptr [[ARRAYIDX6_EPIL]], align 8
+; CHECK-NEXT: [[ADD7_EPIL]] = add nsw i64 [[ADD75_EPIL]], 2
+; CHECK-NEXT: [[EPIL_ITER_CMP:%.*]] = icmp eq i64 [[ADD7_EPIL]], 0
+; CHECK-NEXT: br i1 [[EPIL_ITER_CMP]], label %[[FOR_END:.*]], label %[[FOR_BODY]]
+; CHECK: [[FOR_END]]:
+; CHECK-NEXT: ret void
+;
entry:
br label %for.body
@@ -20,17 +36,6 @@ for.body:
%epil.iter.cmp = icmp eq i64 %add7.epil, 0
br i1 %epil.iter.cmp, label %for.end, label %for.body
- ; CHECK: %[[phi:.*]] = phi i64
- ; CHECK: %[[add1:.*]] = add nsw i64 %[[phi]], 268435457
- ; CHECK: %[[gep1:.*]] = getelementptr inbounds i64, ptr %b, i64 %[[add1]]
- ; CHECK: %[[load:.*]] = load i64, ptr %[[gep1]], align 8
- ; CHECK: %[[add2:.*]] = add nsw i64 %[[phi]], 805306369
- ; CHECK: %[[gep2:.*]] = getelementptr inbounds i64, ptr %b, i64 %[[add2]]
- ; CHECK: store i64 %[[load]], ptr %[[gep2]], align 8
- ; CHECK: %[[incr:.*]] = add nsw i64 %[[phi]], 2
- ; CHECK: %[[cmp:.*]] = icmp eq i64 %[[incr]], 0
- ; CHECK: br i1 %[[cmp]]
-
for.end:
ret void
}
diff --git a/llvm/test/Transforms/LoopDistribute/program-order.ll b/llvm/test/Transforms/LoopDistribute/program-order.ll
index 42e80f22e6930..c926cc0464a7e 100644
--- a/llvm/test/Transforms/LoopDistribute/program-order.ll
+++ b/llvm/test/Transforms/LoopDistribute/program-order.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -passes=loop-distribute -enable-loop-distribute -S -verify-loop-info -verify-dom-info < %s \
; RUN: | FileCheck %s
@@ -12,24 +13,36 @@
; S3: C[i] = d * E[i];
; }
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.10.0"
-
-define void @f(ptr noalias %a,
- ptr noalias %b,
- ptr noalias %c,
- ptr noalias %d,
- ptr noalias %e) {
+define void @f(ptr noalias %a, ptr noalias %b, ptr noalias %c, ptr noalias %d, ptr noalias %e) {
+; CHECK-LABEL: define void @f(
+; CHECK-SAME: ptr noalias [[A:%.*]], ptr noalias [[B:%.*]], ptr noalias [[C:%.*]], ptr noalias [[D:%.*]], ptr noalias [[E:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: br label %[[FOR_BODY:.*]]
+; CHECK: [[FOR_BODY]]:
+; CHECK-NEXT: [[IND:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[ADD:%.*]], %[[FOR_BODY]] ]
+; CHECK-NEXT: [[ARRAYIDXA:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[IND]]
+; CHECK-NEXT: [[LOADA:%.*]] = load i32, ptr [[ARRAYIDXA]], align 4
+; CHECK-NEXT: [[ARRAYIDXB:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[IND]]
+; CHECK-NEXT: [[LOADB:%.*]] = load i32, ptr [[ARRAYIDXB]], align 4
+; CHECK-NEXT: [[MULA:%.*]] = mul i32 [[LOADB]], [[LOADA]]
+; CHECK-NEXT: [[ARRAYIDXD:%.*]] = getelementptr inbounds i32, ptr [[D]], i64 [[IND]]
+; CHECK-NEXT: [[LOADD:%.*]] = load i32, ptr [[ARRAYIDXD]], align 4
+; CHECK-NEXT: [[ADD]] = add nuw nsw i64 [[IND]], 1
+; CHECK-NEXT: [[ARRAYIDXA_PLUS_4:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[ADD]]
+; CHECK-NEXT: store i32 [[MULA]], ptr [[ARRAYIDXA_PLUS_4]], align 4
+; CHECK-NEXT: [[ARRAYIDXC:%.*]] = getelementptr inbounds i32, ptr [[C]], i64 [[IND]]
+; CHECK-NEXT: [[ARRAYIDXE:%.*]] = getelementptr inbounds i32, ptr [[E]], i64 [[IND]]
+; CHECK-NEXT: [[LOADE:%.*]] = load i32, ptr [[ARRAYIDXE]], align 4
+; CHECK-NEXT: [[MULC:%.*]] = mul i32 [[LOADD]], [[LOADE]]
+; CHECK-NEXT: store i32 [[MULC]], ptr [[ARRAYIDXC]], align 4
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[ADD]], 20
+; CHECK-NEXT: br i1 [[EXITCOND]], label %[[FOR_END:.*]], label %[[FOR_BODY]]
+; CHECK: [[FOR_END]]:
+; CHECK-NEXT: ret void
+;
entry:
br label %for.body
-; CHECK: entry:
-; CHECK: br label %for.body
-; CHECK: for.body:
-; CHECK: br i1 %exitcond, label %for.end, label %for.body
-; CHECK: for.end:
-; CHECK: ret void
-
for.body: ; preds = %for.body, %entry
%ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
diff --git a/llvm/test/Transforms/LoopDistribute/scev-inserted-runtime-check.ll b/llvm/test/Transforms/LoopDistribute/scev-inserted-runtime-check.ll
index fa3448e28041a..4e75699c91773 100644
--- a/llvm/test/Transforms/LoopDistribute/scev-inserted-runtime-check.ll
+++ b/llvm/test/Transforms/LoopDistribute/scev-inserted-runtime-check.ll
@@ -1,7 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -passes=loop-distribute -enable-loop-distribute -S -enable-mem-access-versioning=0 < %s | FileCheck %s
-
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+; RUN: opt -passes=loop-distribute -enable-loop-distribute -verify-loop-info -verify-dom-info -S -enable-mem-access-versioning=0 < %s | FileCheck %s
; PredicatedScalarEvolution decides it needs to insert a bounds check
; not based on memory access.
diff --git a/llvm/test/Transforms/LoopDistribute/symbolic-stride.ll b/llvm/test/Transforms/LoopDistribute/symbolic-stride.ll
index 07c50b5b61162..2edd6e4f85a64 100644
--- a/llvm/test/Transforms/LoopDistribute/symbolic-stride.ll
+++ b/llvm/test/Transforms/LoopDistribute/symbolic-stride.ll
@@ -14,12 +14,7 @@
; C[i] = D[i] * A[stride * i];
; }
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.10.0"
-
-define void @f(ptr noalias %a,
-;
-;
+define void @f(ptr noalias %a, ptr noalias %b, ptr noalias %c, ptr noalias %d, i64 %stride) {
; DEFAULT-LABEL: @f(
; DEFAULT-NEXT: entry:
; DEFAULT-NEXT: br label [[FOR_BODY_LVER_CHECK:%.*]]
@@ -110,10 +105,6 @@ define void @f(ptr noalias %a,
; NO-VERSION: for.end:
; NO-VERSION-NEXT: ret void
;
- ptr noalias %b,
- ptr noalias %c,
- ptr noalias %d,
- i64 %stride) {
entry:
br label %for.body
diff --git a/llvm/test/Transforms/LoopDistribute/uncomputable-backedge-taken-count.ll b/llvm/test/Transforms/LoopDistribute/uncomputable-backedge-taken-count.ll
index 075f87097a82d..5427c38ec6cfd 100644
--- a/llvm/test/Transforms/LoopDistribute/uncomputable-backedge-taken-count.ll
+++ b/llvm/test/Transforms/LoopDistribute/uncomputable-backedge-taken-count.ll
@@ -1,9 +1,6 @@
; RUN: opt -passes=loop-distribute -enable-loop-distribute -verify-loop-info -verify-dom-info -S \
; RUN: < %s | FileCheck %s
-target datalayout = "e-m:o-i32:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.10.0"
-
; NOTE: The tests below use infinite loops to force unknown backedge-taken counts.
; Making the exit condition depend on a load would break current loop-distribute,
; because it requires all accesses to end up in either of the loops, but not both.
@@ -11,9 +8,7 @@ target triple = "x86_64-apple-macosx10.10.0"
; TODO
; Can distribute with unknown backedge-taken count, because no runtime checks are
; required.
-define void @unknown_btc_distribute_no_checks_needed(ptr noalias %a,
- ptr noalias %c,
- ptr noalias %d) {
+define void @unknown_btc_distribute_no_checks_needed(ptr noalias %a, ptr noalias %c, ptr noalias %d) {
; CHECK-LABEL: @unknown_btc_distribute_no_checks_needed(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label %for.body
@@ -49,9 +44,7 @@ for.end: ; preds = %for.body
; Cannot distribute with unknown backedge-taken count, because runtime checks for
; induction wrapping are required.
-define void @unknown_btc_do_not_distribute_wrapping_checks(ptr noalias %a,
- ptr noalias %c,
- ptr noalias %d) {
+define void @unknown_btc_do_not_distribute_wrapping_checks(ptr noalias %a, ptr noalias %c, ptr noalias %d) {
; CHECK-LABEL: @unknown_btc_do_not_distribute_wrapping_checks(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label %for.body
diff --git a/llvm/test/Transforms/LoopDistribute/unknown-bounds-for-memchecks.ll b/llvm/test/Transforms/LoopDistribute/unknown-bounds-for-memchecks.ll
index 2f96f9621b9d9..208648b9ec20d 100644
--- a/llvm/test/Transforms/LoopDistribute/unknown-bounds-for-memchecks.ll
+++ b/llvm/test/Transforms/LoopDistribute/unknown-bounds-for-memchecks.ll
@@ -1,4 +1,5 @@
-; RUN: opt -passes=loop-distribute -enable-loop-distribute -S < %s | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -passes=loop-distribute -enable-loop-distribute -verify-loop-info -verify-dom-info -S < %s | FileCheck %s
; If we can't find the bounds for one of the arrays in order to generate the
; memchecks (e.g., C[i * i] below), loop shold not get distributed.
@@ -9,8 +10,6 @@
; C[i * i] = B[i] * 2;
; }
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-
; Verify that we didn't distribute by checking that we still have the original
; number of branches.
@@ -19,12 +18,36 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
@C = common global ptr null, align 8
define void @f() {
+; CHECK-LABEL: define void @f() {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: [[A:%.*]] = load ptr, ptr @A, align 8
+; CHECK-NEXT: [[B:%.*]] = load ptr, ptr @B, align 8
+; CHECK-NEXT: [[C:%.*]] = load ptr, ptr @C, align 8
+; CHECK-NEXT: br label %[[FOR_BODY:.*]]
+; CHECK: [[FOR_BODY]]:
+; CHECK-NEXT: [[IND:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[ADD:%.*]], %[[FOR_BODY]] ]
+; CHECK-NEXT: [[ARRAYIDXA:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[IND]]
+; CHECK-NEXT: [[LOADA:%.*]] = load i32, ptr [[ARRAYIDXA]], align 4
+; CHECK-NEXT: [[MULA:%.*]] = mul i32 [[LOADA]], 3
+; CHECK-NEXT: [[ADD]] = add nuw nsw i64 [[IND]], 1
+; CHECK-NEXT: [[ARRAYIDXA_PLUS_4:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[ADD]]
+; CHECK-NEXT: store i32 [[MULA]], ptr [[ARRAYIDXA_PLUS_4]], align 4
+; CHECK-NEXT: [[ARRAYIDXB:%.*]] = getelementptr inbounds i32, ptr [[B]], i64 [[IND]]
+; CHECK-NEXT: [[LOADB:%.*]] = load i32, ptr [[ARRAYIDXB]], align 4
+; CHECK-NEXT: [[MULC:%.*]] = mul i32 [[LOADB]], 2
+; CHECK-NEXT: [[IND_2:%.*]] = mul i64 [[IND]], [[IND]]
+; CHECK-NEXT: [[ARRAYIDXC:%.*]] = getelementptr inbounds i32, ptr [[C]], i64 [[IND_2]]
+; CHECK-NEXT: store i32 [[MULC]], ptr [[ARRAYIDXC]], align 4
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[ADD]], 20
+; CHECK-NEXT: br i1 [[EXITCOND]], label %[[FOR_END:.*]], label %[[FOR_BODY]]
+; CHECK: [[FOR_END]]:
+; CHECK-NEXT: ret void
+;
entry:
%a = load ptr, ptr @A, align 8
%b = load ptr, ptr @B, align 8
%c = load ptr, ptr @C, align 8
br label %for.body
-; CHECK: br
for.body: ; preds = %for.body, %entry
%ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
@@ -49,8 +72,6 @@ for.body: ; preds = %for.body, %entry
%exitcond = icmp eq i64 %add, 20
br i1 %exitcond, label %for.end, label %for.body
-; CHECK: br
-; CHECK-NOT: br
for.end: ; preds = %for.body
ret void
More information about the llvm-commits
mailing list