[LoopFusion] Drop duplicate write-write dependence check (NFC) (#203173)

`dependencesAllowFusion()` re-tested every FC0-write vs FC1-write pair
in the second loop nest, duplicating the checks already done in the
first. Iterate only the remaining FC0-read vs FC1-write pairs; the set
of checked dependences (W0xW1, W0xR1, R0xW1) is unchanged.
This commit is contained in:
Madhur Amilkanthwar 2026-06-11 14:57:41 +05:30 committed by GitHub
parent 700ff25b03
commit b836063bbf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1203,16 +1203,13 @@ private:
}
}
for (Instruction *WriteL1 : FC1.MemWrites) {
for (Instruction *WriteL0 : FC0.MemWrites)
if (!dependencesAllowFusion(FC0, FC1, *WriteL0, *WriteL1)) {
return false;
}
for (Instruction *ReadL0 : FC0.MemReads)
// Write-write and write-read pairs are already covered above; only the
// read-before-write pairs from FC0 reads to FC1 writes remain.
for (Instruction *ReadL0 : FC0.MemReads)
for (Instruction *WriteL1 : FC1.MemWrites)
if (!dependencesAllowFusion(FC0, FC1, *ReadL0, *WriteL1)) {
return false;
}
}
// Walk through all uses in FC1. For each use, find the reaching def. If the
// def is located in FC0 then it is not safe to fuse.