AMDGPU: Break read2/write2 search range on a memory fence
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 24 Apr 2020 14:06:00 +0000 (10:06 -0400)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 24 Apr 2020 19:53:30 +0000 (15:53 -0400)
commit35e6a9c8397e9550382961f2e020987982e9ccd7
treec26d64777f2865b76234647436306f8067f0186e
parent0d671dbca949e70536da371a43dc55248301705f
AMDGPU: Break read2/write2 search range on a memory fence

This is to fix performance regressions introduced by
86c944d790728891801778b8d98c2c65a83f36a5.

The old search would collect all potentially mergeable instructions in
the entire block. In this case, the same address is written in
multiple places in the block on the other side of a fence. When sorted
by offset, the two unmergeable, identical addresses would be next to
each other and the merge would give up.

Break the search space when we encounter an instruction we won't be
able to merge across. This will keep the identical addresses in
different merge attempts.

This may also improve compile time by reducing the merge list size.
llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp
llvm/test/CodeGen/AMDGPU/fence-lds-read2-write2.ll [new file with mode: 0644]