Skip to content

Commit 4969a8c

Browse files
committed
fixup! [MachinePipeliner] Improve loop carried dependence analysis
1 parent 6201e3b commit 4969a8c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

llvm/lib/CodeGen/MachinePipeliner.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2824,6 +2824,10 @@ bool SwingSchedulerDAG::mayOverlapInLaterIter(
28242824
<< ", Len: " << AccessSizeO.getValue() << "\n";
28252825
});
28262826

2827+
// Excessive overlap may be detected in strided patterns.
2828+
// For example, the memory addresses of the store and the load in
2829+
// for (i=0; i<n; i+=2) a[i+1] = a[i];
2830+
// are assumed to overlap.
28272831
if (Delta < 0) {
28282832
int64_t BaseMinAddr = OffsetB;
28292833
int64_t OhterNextIterMaxAddr = OffsetO + Delta + AccessSizeO.getValue() - 1;

llvm/test/CodeGen/Hexagon/swp-carried-dep2.mir

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
# RUN: llc -mtriple=hexagon -run-pass pipeliner -debug-only=pipeliner %s -o /dev/null 2>&1 -pipeliner-experimental-cg=true | FileCheck %s
22
# REQUIRES: asserts
33

4-
# Test that it correctly recognizes that there is no loop carried dependence
4+
# Test that the loop carried dependence check correctly identifies dependences
55
# when the loop variable decreases and the array index offset is negative.
66

7+
# No dependence from the store to the load.
78
# CHECK: Overlap check:
89
# CHECK-NEXT: BaseMI: S2_storeri_io %{{[0-9]+}}:intregs, 0, %{{[0-9]+}}:intregs :: (store (s32) into %ir.lsr.iv1)
910
# CHECK-NEXT: Base + 0 + I * -4, Len: 4
1011
# CHECK-NEXT: OtherMI: %{{[0-9]+}}:intregs = L2_loadri_io %{{[0-9]+}}:intregs, -8 :: (load (s32) from %ir.cgep)
1112
# CHECK-NEXT: Base + -8 + I * -4, Len: 4
1213
# CHECK-NEXT: Result: No overlap
1314

15+
# TODO: There is a loop carried dependence from the load to the store but it
16+
# is not recognised. addLoopCarriedDependences() should be modified to
17+
# recognise the dependence and enable the following checks.
18+
# CHECK-AFTER-FIX: Overlap check:
19+
# CHECK-AFTER-FIX-NEXT: BaseMI: %{{[0-9]+}}:intregs = L2_loadri_io %{{[0-9]+}}:intregs, -8 :: (load (s32) from %ir.cgep)
20+
# CHECK-AFTER-FIX-NEXT: Base + -8 + I * -4, Len: 4
21+
# CHECK-AFTER-FIX-NEXT: OtherMI: S2_storeri_io %{{[0-9]+}}:intregs, 0, %{{[0-9]+}}:intregs :: (store (s32) into %ir.lsr.iv1)
22+
# CHECK-AFTER-FIX-NEXT: Base + 0 + I * -4, Len: 4
23+
# CHECK-AFTER-FIX-NEXT: Result: Overlap!
24+
1425
--- |
1526

1627
define void @test() {

0 commit comments

Comments
 (0)