1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

Revert "[LAA] Support pointer phis in loop by analyzing each incoming pointer."

This reverts commit 1ed7f8ede564c3b11da4fdca30c36ccbff422576.

This change can cause loop-distribute to crash in some cases. Revert
until I have more time to wrap up a fix.

See  PR50296, PR5028 and D102266.
This commit is contained in:
Florian Hahn 2021-05-28 10:32:40 +01:00
parent 64ac3b3090
commit bfb6ec9cb5
3 changed files with 8 additions and 48 deletions

View File

@ -1938,18 +1938,7 @@ void LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
if (blockNeedsPredication(ST->getParent(), TheLoop, DT))
Loc.AATags.TBAA = nullptr;
// SCEV does not look through non-header PHIs inside the loop. Such phis
// can be analyzed by adding separate accesses for each incoming pointer
// value.
auto *PN = dyn_cast<PHINode>(Loc.Ptr);
if (PN && TheLoop->contains(PN->getParent()) &&
PN->getParent() != TheLoop->getHeader()) {
for (const Use &Inc : PN->incoming_values()) {
MemoryLocation NewLoc = Loc.getWithNewPtr(Inc);
Accesses.addStore(NewLoc);
}
} else
Accesses.addStore(Loc);
Accesses.addStore(Loc);
}
}
@ -1993,17 +1982,7 @@ void LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
if (blockNeedsPredication(LD->getParent(), TheLoop, DT))
Loc.AATags.TBAA = nullptr;
// SCEV does not look through non-header PHIs inside the loop. Such phis can
// be analyzed by adding separate accesses for each incoming pointer value.
auto *PN = dyn_cast<PHINode>(Loc.Ptr);
if (PN && TheLoop->contains(PN->getParent()) &&
PN->getParent() != TheLoop->getHeader()) {
for (const Use &Inc : PN->incoming_values()) {
MemoryLocation NewLoc = Loc.getWithNewPtr(Inc);
Accesses.addLoad(NewLoc, IsReadOnlyPtr);
}
} else
Accesses.addLoad(Loc, IsReadOnlyPtr);
Accesses.addLoad(Loc, IsReadOnlyPtr);
}
// If we write (or read-write) to a single destination and there are no

View File

@ -6,7 +6,7 @@
define i32 @load_with_pointer_phi_no_runtime_checks(%s1* %data) {
; CHECK-LABEL: load_with_pointer_phi_no_runtime_checks
; CHECK-NEXT: loop.header:
; CHECK-NEXT: Memory dependences are safe
; CHECK-NEXT: Report: cannot identify array bounds
;
entry:
br label %loop.header
@ -41,7 +41,7 @@ exit: ; preds = %loop.latch
define i32 @store_with_pointer_phi_no_runtime_checks(%s1* %data) {
; CHECK-LABEL: 'store_with_pointer_phi_no_runtime_checks'
; CHECK-NEXT: loop.header:
; CHECK-NEXT: Memory dependences are safe
; CHECK-NEXT: Report: cannot identify array bounds
;
entry:
br label %loop.header
@ -76,23 +76,7 @@ exit: ; preds = %loop.latch
define i32 @store_with_pointer_phi_runtime_checks(double* %A, double* %B, double* %C) {
; CHECK-LABEL: 'store_with_pointer_phi_runtime_checks'
; CHECK-NEXT: loop.header:
; CHECK-NEXT: Memory dependences are safe with run-time checks
; CHECK: Run-time memory checks:
; CHECK-NEXT: Check 0:
; CHECK-NEXT: Comparing group ([[GROUP_C:.+]]):
; CHECK-NEXT: %gep.2 = getelementptr inbounds double, double* %C, i64 %iv
; CHECK-NEXT: Against group ([[GROUP_B:.+]]):
; CHECK-NEXT: %gep.1 = getelementptr inbounds double, double* %B, i64 %iv
; CHECK-NEXT: Check 1:
; CHECK-NEXT: Comparing group ([[GROUP_C]]):
; CHECK-NEXT: %gep.2 = getelementptr inbounds double, double* %C, i64 %iv
; CHECK-NEXT: Against group ([[GROUP_A:.+]]):
; CHECK-NEXT: %arrayidx = getelementptr inbounds double, double* %A, i64 %iv
; CHECK-NEXT: Check 2:
; CHECK-NEXT: Comparing group ([[GROUP_B]]):
; CHECK-NEXT: %gep.1 = getelementptr inbounds double, double* %B, i64 %iv
; CHECK-NEXT: Against group ([[GROUP_A]]):
; CHECK-NEXT: %arrayidx = getelementptr inbounds double, double* %A, i64 %iv
; CHECK-NEXT: Report: cannot identify array bounds
;
entry:
br label %loop.header

View File

@ -4,8 +4,7 @@
define i32 @load_with_pointer_phi_no_runtime_checks(%s1* %data) {
; CHECK-LABEL: @load_with_pointer_phi_no_runtime_checks
; CHECK-NOT: memcheck
; CHECK: vector.body:
; CHECK-NOT: vector.body
;
entry:
br label %loop.header
@ -39,8 +38,7 @@ exit: ; preds = %loop.latch
define i32 @store_with_pointer_phi_no_runtime_checks(%s1* %data) {
; CHECK-LABEL: @store_with_pointer_phi_no_runtime_checks
; CHECK-NOT: memcheck
; CHECK: vector.body
; CHECK-NOT: vector.body
;
entry:
br label %loop.header
@ -74,8 +72,7 @@ exit: ; preds = %loop.latch
define i32 @store_with_pointer_phi_runtime_checks(double* %A, double* %B, double* %C) {
; CHECK-LABEL: @store_with_pointer_phi_runtime_checks
; CHECK: memcheck
; CHECK: vector.body
; CHECK-NOT: vector.body
;
entry:
br label %loop.header