This is an archive of the discontinued LLVM Phabricator instance.

[X86] Fix avoid store forwarding blocks pass for negative displacements
ClosedPublic

Authored by nikic on Dec 9 2018, 3:49 AM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

nikic created this revision.Dec 9 2018, 3:49 AM
RKSimon added inline comments.Dec 9 2018, 3:52 AM
test/CodeGen/X86/pr39926.ll
3 ↗(On Diff #177406)

Please commit this with trunk's current codegen and rebase so the patch shows the codegen diff.

nikic updated this revision to Diff 177410.Dec 9 2018, 4:13 AM

Rebase over committed test.

lsaba accepted this revision.Dec 10 2018, 12:47 AM
This revision is now accepted and ready to land.Dec 10 2018, 12:47 AM
This revision was automatically updated to reflect the committed changes.