This is an archive of the discontinued LLVM Phabricator instance.

[Alignment][NFC] Use 5 bits to store Instructions Alignment
ClosedPublic

Authored by gchatelet on Jul 3 2020, 1:04 AM.

Details

Summary

As per MaxAlignmentExponent alignment is not allowed to be more than 2^29.
Encoded as Log2, this means that storing alignment uses 5 bits.
This patch makes sure all instructions store their alignment in a consistent way, encoded as Log2 and using 5 bits.

Diff Detail

Event Timeline

gchatelet created this revision.Jul 3 2020, 1:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 3 2020, 1:04 AM
gchatelet edited the summary of this revision. (Show Details)Jul 3 2020, 1:07 AM
gchatelet updated this revision to Diff 275322.Jul 3 2020, 1:14 AM
  • Remove assert and move implementation in header
courbet accepted this revision.Jul 3 2020, 1:24 AM

Cool ! Only minor comments.

llvm/include/llvm/IR/Instruction.h
59

Add comment: // Align(1) is stored as 0. Valid alignments are powers of two from 2^0 to 2^MaxAlignmentExponent = 2^29, so we need 5 bits to encode the 30 possible values.

61

[bikeshedding] Shouldn't that be AlignmentBitfieldElement ?

This revision is now accepted and ready to land.Jul 3 2020, 1:24 AM
gchatelet marked 3 inline comments as done.Jul 3 2020, 1:53 AM
gchatelet added inline comments.
llvm/include/llvm/IR/Instruction.h
59

I've reworded it a bit. I hope you don't mind.

gchatelet updated this revision to Diff 275328.Jul 3 2020, 1:53 AM
gchatelet marked an inline comment as done.
  • Address comments
This revision was automatically updated to reflect the committed changes.
Harbormaster completed remote builds in B62815: Diff 275320.
Harbormaster completed remote builds in B62817: Diff 275322.