This is an archive of the discontinued LLVM Phabricator instance.

[XRay] Align entry and return sleds to 2 byte boundaries
ClosedPublic

Authored by dberris on Aug 2 2016, 7:55 PM.

Details

Summary

This should ensure that we can atomically write two bytes (on top of the
retq and the one past it) and have those two bytes not straddle cache
lines.

We also move the label past the alignment instruction so that we can refer
to the actual first instruction, as opposed to potential padding before the
aligned instruction.

Update the tests to allow us to reflect the new order of assembly.

Diff Detail

Event Timeline

dberris updated this revision to Diff 66610.Aug 2 2016, 7:55 PM
dberris retitled this revision from to Align XRay return sleds to 2 byte boundaries.
dberris updated this object.
dberris added reviewers: rSerge, echristo, majnemer.
dberris added a subscriber: llvm-commits.
rSerge added inline comments.Aug 3 2016, 5:14 AM
lib/Target/X86/X86MCInstLower.cpp
1078

Did you mean .p2align directive instead of .palign ?

1085

Why aligning at 4 bytes? Wouldn't 2 suffice?

dberris updated this revision to Diff 66754.Aug 3 2016, 8:47 PM
dberris marked 2 inline comments as done.

Use 2-byte alignment for both entry and exit sleds.

lib/Target/X86/X86MCInstLower.cpp
1078

Thanks, yes, typo. :)

1085

That's right, I clearly wasn't thinking this through very well. :)

dberris updated this revision to Diff 66762.Aug 3 2016, 11:50 PM
  • Emit label after alignment directive
  • Adjust test to new order
dberris retitled this revision from Align XRay return sleds to 2 byte boundaries to [XRay] Align entry and return sleds to 2 byte boundaries.Aug 3 2016, 11:54 PM
dberris updated this object.
rSerge accepted this revision.Aug 3 2016, 11:57 PM
rSerge edited edge metadata.
This revision is now accepted and ready to land.Aug 3 2016, 11:57 PM
This revision was automatically updated to reflect the committed changes.