[SWP] Recognize mem carried dep with different base
authorThomas Preud'homme <thomasp@graphcore.ai>
Fri, 21 Oct 2022 14:42:56 +0000 (15:42 +0100)
committerThomas Preud'homme <thomasp@graphcore.ai>
Mon, 7 Nov 2022 09:53:41 +0000 (09:53 +0000)
commitc8be35293c82f216e975c56f62ddf9199a22f2e2
treed3a6151ab24c3d27dc4d3d18125e795b39d46aef
parenteb421c0c0edf8420b00bc8d51bb1160c3eda9661
[SWP] Recognize mem carried dep with different base

The loop-carried dependency detection logic in isLoopCarriedDep relies
on the load and store using the same definition for the base register.
This misses the case of post-increment loads and stores whose base
register are different PHI initialized from the same initial value.

This commit extends the logic to accept the load and store having
different PHI base address provided that they had the same initial value
when entering the loop and are incremented by the same amount in each
loop.

Reviewed By: bcahoon

Differential Revision: https://reviews.llvm.org/D136463
llvm/lib/CodeGen/MachinePipeliner.cpp
llvm/test/CodeGen/Hexagon/swp-carried-dep3.mir [new file with mode: 0644]