This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Fix an off-by-one error when restoring LR for 16-bit Thumb
ClosedPublic

Authored by chill on Nov 21 2017, 7:28 AM.

Details

Summary

This commit https://reviews.llvm.org/rL318143 computes incorrectly to offset to restore LR from.

The number of tPOP operands is 2 (condition) + 2 (implicit def and use of SP) + count of the popped registers. We need to load LR from just past the last register, hence the correct offset should be either getNumOperands() - 4 and getNumExplicitOperands() - 2 (multiplied by 4).

Diff Detail

Repository
rL LLVM

Event Timeline

chill created this revision.Nov 21 2017, 7:28 AM
efriedma accepted this revision.Nov 21 2017, 11:07 AM

LGTM, but please test your patches more carefully in the future.

This revision is now accepted and ready to land.Nov 21 2017, 11:07 AM
This revision was automatically updated to reflect the committed changes.
chill added a comment.Nov 27 2017, 2:14 AM

LGTM, but please test your patches more carefully in the future.

Sorry about that. Many thanks for the review and comments.