[PATCH] D60135: [Pipeliner] Incorrect loop carried dependence calculation
Denis Antrushin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 2 09:01:34 PDT 2019
dantrushin created this revision.
dantrushin added a reviewer: bcahoon.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
SwingSchedulerDAG::isLoopCarriedDep performs incorrect dependence
calculations. In particular, it cannot properly handle negative
offsets like this:
%1 = PHI %0, %2
%x = LD [%1, -6] // 32-bit load
...
ST %y, [%1, 2] // 32-bit store
%2 = ADD %1, 4
and case of stride smaller than access size like this:
%1 = PHI %0, %2
%x = LD [%1, 0] // 32-bit load
...
ST %y, [%1, 2] // 32-bit store
%2 = ADD %1, 2
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D60135
Files:
llvm/lib/CodeGen/MachinePipeliner.cpp
Index: llvm/lib/CodeGen/MachinePipeliner.cpp
===================================================================
--- llvm/lib/CodeGen/MachinePipeliner.cpp
+++ llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -3167,12 +3167,14 @@
// This is the main test, which checks the offset values and the loop
// increment value to determine if the accesses may be loop carried.
- if (OffsetS >= OffsetD)
- return OffsetS + AccessSizeS > DeltaS;
- else
- return OffsetD + AccessSizeD > DeltaD;
+ if (AccessSizeS == MemoryLocation::UnknownSize ||
+ AccessSizeD == MemoryLocation::UnknownSize)
+ return true;
- return true;
+ if (DeltaS != DeltaD || DeltaS < AccessSizeS || DeltaD < AccessSizeD)
+ return true;
+
+ return (OffsetS + (int64_t)AccessSizeS < OffsetD + (int64_t)AccessSizeD);
}
void SwingSchedulerDAG::postprocessDAG() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60135.193309.patch
Type: text/x-patch
Size: 850 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190402/b18ad332/attachment.bin>
More information about the llvm-commits
mailing list