This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Clear the constant pool cache on explicit .ltorg directives
ClosedPublic

Authored by mstorsjo on May 3 2017, 11:56 PM.

Details

Summary

Multiple ldr pseudoinstructions with the same constant value will reuse the same constant pool entry. However, if the constant pool is explicitly flushed with a .ltorg directive, we should not try to reference constants in the previous pool any longer, since they may be out of range.

This fixes assembling hand-written assembler source which repeatedly loads the same constant value, across a binary size larger than the pc-relative fixup range for ldr instructions (4096 bytes). Such assembler source already uses explicit .ltorg instructions to emit constant pools with regular intervals. However if we try to reuse constants emitted in earlier pools, they end up out of range.

This makes the output of the testcase match what binutils gas does (prior to this patch, this would fail to assemble).

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.May 3 2017, 11:56 PM

For the record (I forgot to include in the original summary); this patch makes the output of the testcase match what binutils gas does (prior to this patch, this would fail to assemble).

mstorsjo edited the summary of this revision. (Show Details)May 8 2017, 1:44 AM
mstorsjo added a reviewer: jmolloy.
jmolloy accepted this revision.May 8 2017, 1:56 AM

Hi,

I think this looks fine to me.

James

This revision is now accepted and ready to land.May 8 2017, 1:56 AM
This revision was automatically updated to reflect the committed changes.