This is an archive of the discontinued LLVM Phabricator instance.

Use align parameter attribute for all pointer arguments
ClosedPublic

Authored by hfinkel on Jul 22 2014, 9:01 AM.

Details

Summary

This is almost more of a documentation change than anything else...

We currently support the align attribute on all (pointer) parameters, but we only use it for byval parameters. However, it is completely consistent at the IR level to treat 'align n' on all pointer parameters as an alignment assumption on the pointer. This patch does this:

  1. Causes computeKnownBits to use the align attribute on all pointer parameters, not just byval parameters.
  2. Updated the LangRef to document the align parameter attribute (as it turns out, it was not documented at all previously, although the byval documentation mentioned that it could be used).

There are two benefits to doing this:

  1. It allows enhancing alignment based on the pointer alignment after inlining
  2. It allows simplification of pointer arithmetic

My primary use case for these things involves pointers that are over-aligned to allow for efficient vectorized code generation.

Thanks again!

Diff Detail

Event Timeline

hfinkel updated this revision to Diff 11760.Jul 22 2014, 9:01 AM
hfinkel retitled this revision from to Use align parameter attribute for all pointer arguments.
hfinkel updated this object.
hfinkel edited the test plan for this revision. (Show Details)
hfinkel added a subscriber: Unknown Object (MLST).
chandlerc edited edge metadata.Jul 22 2014, 9:31 AM

LGTM, seems like obvious goodness to me.

reames edited edge metadata.Jul 22 2014, 9:55 AM

Same. LGTM.

I take it you're going to canonicalize assumptions about alignment as
align attributes where possible?

Philip

hfinkel accepted this revision.Jul 22 2014, 10:07 AM
hfinkel added a reviewer: hfinkel.

(will close)

This revision is now accepted and ready to land.Jul 22 2014, 10:07 AM
hfinkel closed this revision.Jul 22 2014, 10:08 AM

r213670, thanks!