This is an archive of the discontinued LLVM Phabricator instance.

[Alignment][NFC] Deprecate getMaxAlignment
ClosedPublic

Authored by gchatelet on Mar 18 2020, 2:51 AM.

Details

Summary

This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Diff Detail

Event Timeline

gchatelet created this revision.Mar 18 2020, 2:51 AM
courbet added inline comments.Mar 18 2020, 5:50 AM
llvm/lib/Target/Mips/MipsSEFrameLowering.cpp
542

why Log2 ?

llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
872

ditto

gchatelet marked 3 inline comments as done.Mar 18 2020, 6:26 AM
gchatelet added inline comments.
llvm/lib/Target/Mips/MipsSEFrameLowering.cpp
542
  • isInt<N> from documentation Checks if an integer fits into the given bit width.
  • MFI.getMaxAlign() is an Align which by definition is 2^N

So testing if a power of two fits into 16 bits is equivalent to testing if its log2 is less than 16 (the maximum power of 2 fitting in 16 bits is 0b1000000000000000, its log2 is 15)

This is also faster as .value() (in MachineFrameInfo) will generate the value from a shift, where Log2 is a noop.

courbet accepted this revision.Mar 18 2020, 6:43 AM
This revision is now accepted and ready to land.Mar 18 2020, 6:43 AM
This revision was automatically updated to reflect the committed changes.
gchatelet marked an inline comment as done.