diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2018-12-10 10:16:50 +0000 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2018-12-10 10:16:50 +0000 |
| commit | e79477895e1af4425aecaded2881e3b3c878faf5 (patch) | |
| tree | 6503d83459b9f20bd928808f12220b80137cc2ae /llvm/lib | |
| parent | 1f958ed2693e889b6a02c7381578d2d202a1a409 (diff) | |
| download | bcm5719-llvm-e79477895e1af4425aecaded2881e3b3c878faf5.tar.gz bcm5719-llvm-e79477895e1af4425aecaded2881e3b3c878faf5.zip | |
[X86] Fix AvoidStoreForwardingBlocks pass for negative displacements
Fixes https://bugs.llvm.org/show_bug.cgi?id=39926.
The size of the first copy was computed as
std::abs(std::abs(LdDisp2) - std::abs(LdDisp1)), which results in
skipped bytes if the signs of LdDisp2 and LdDisp1 differ. As far as
I can see, this should just be LdDisp2 - LdDisp1. The case where
LdDisp1 > LdDisp2 is already handled in the code above, in which case
LdDisp2 is set to LdDisp1 and this subtraction will evaluate to
Size1 = 0, which is the correct value to skip an overlapping copy.
Differential Revision: https://reviews.llvm.org/D55485
llvm-svn: 348750
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp b/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp index eb9c4b3e597..2850baf7a65 100644 --- a/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp +++ b/llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp @@ -586,7 +586,7 @@ void X86AvoidSFBPass::breakBlockedCopies( StDisp2 += OverlapDelta; Size2 -= OverlapDelta; } - Size1 = std::abs(std::abs(LdDisp2) - std::abs(LdDisp1)); + Size1 = LdDisp2 - LdDisp1; // Build a copy for the point until the current blocking store's // displacement. |

