This is an archive of the discontinued LLVM Phabricator instance.

ARM: Only enforce 4-byte alignment on Thumb-2 functions with constant pools.
ClosedPublic

Authored by pcc on Apr 20 2015, 7:54 PM.

Details

Summary

This appears to have been introduced back in r76698 as part of an unrelated
change. I can find no official ARM documentation stating that Thumb-2 functions
require 4-byte alignment; in fact, ARM documentation appears to contradict
this (see, e.g., ARM Architecture Reference Manual Thumb-2 Supplement,
section 2.6.1: "Thumb-2 enforces 16-bit alignment on all instructions.").

Also remove code that sets alignment for ARM functions, which is redundant
with code in the MachineFunction constructor, and remove the hidden
-arm-align-constant-islands flag, which has been enabled by default since
r146739 (Dec 2011) and has probably received sufficient testing by now.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc updated this revision to Diff 24094.Apr 20 2015, 7:54 PM
pcc retitled this revision from to ARM: Do not enforce 4-byte alignment on Thumb-2 functions..
pcc updated this object.
pcc edited the test plan for this revision. (Show Details)
pcc added a reviewer: t.p.northover.
pcc added a subscriber: Unknown Object (MLST).
pcc updated this revision to Diff 24095.Apr 20 2015, 8:00 PM
  • Fix test
rengolin added inline comments.Apr 22 2015, 11:06 AM
lib/Target/ARM/ARMConstantIslandPass.cpp
416 ↗(On Diff #24095)

This is not just about standard Thumb alignment, but Thumb functions with constant pools, which are also expected to align 4, if memory serves me right. Is that what you're testing down there on your new test?

I wonder if that's going to open an old corner case...

pcc retitled this revision from ARM: Do not enforce 4-byte alignment on Thumb-2 functions. to ARM: Only enforce 4-byte alignment on Thumb-2 functions with constant pools..Apr 22 2015, 11:17 AM
pcc added inline comments.
lib/Target/ARM/ARMConstantIslandPass.cpp
416 ↗(On Diff #24095)

This is not just about standard Thumb alignment, but Thumb functions with constant pools, which are also expected to align 4, if memory serves me right.

Exactly. We are now only setting the alignment in cases where a constant pool makes it necessary (see lines 504-508 of the new file). I've retitled the change to make this clear.

Is that what you're testing down there on your new test?

Yes.

rengolin accepted this revision.Apr 23 2015, 2:47 AM
rengolin added a reviewer: rengolin.

Great! LGTM, Thanks!

This revision is now accepted and ready to land.Apr 23 2015, 2:47 AM
This revision was automatically updated to reflect the committed changes.