Make use of the align parameter attribute for all pointer arguments
authorHal Finkel <hfinkel@anl.gov>
Tue, 22 Jul 2014 16:58:55 +0000 (16:58 +0000)
committerHal Finkel <hfinkel@anl.gov>
Tue, 22 Jul 2014 16:58:55 +0000 (16:58 +0000)
commitb3b2aac5be89b327a5450affa743f2da2a906d7e
tree84a03dc95bcb03b70f6ab8ec34a41235db84281c
parent50f2f1434c74cc5ba20008bd097421a28d0f0738
Make use of the align parameter attribute for all pointer arguments

We previously supported the align attribute on all (pointer) parameters, but we
only used 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, and now we wll. Specifically, this causes
computeKnownBits to use the align attribute on all pointer parameters, not just
byval parameters. I've also added an explicit parameter attribute test for this
to test/Bitcode/attributes.ll.

And I've 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 (at least) two benefits to doing this:
 - It allows enhancing alignment based on the pointer alignment after inlining callees.
 - It allows simplification of pointer arithmetic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213670 91177308-0d34-0410-b5e6-96231b3b80d8
docs/LangRef.rst
lib/Analysis/ValueTracking.cpp
test/Bitcode/attributes.ll
test/Transforms/InstCombine/align-attr.ll [new file with mode: 0644]