From ccc7090671cda0f1a6578988659b877b57d91ce5 Mon Sep 17 00:00:00 2001 From: Hal Finkel Date: Tue, 22 Jul 2014 16:58:55 +0000 Subject: 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. llvm-svn: 213670 --- llvm/test/Bitcode/attributes.ll | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/test/Bitcode') diff --git a/llvm/test/Bitcode/attributes.ll b/llvm/test/Bitcode/attributes.ll index 2490e592072..9a429f6e21f 100644 --- a/llvm/test/Bitcode/attributes.ll +++ b/llvm/test/Bitcode/attributes.ll @@ -239,6 +239,11 @@ define dereferenceable(18446744073709551606) i8* @f40(i8* dereferenceable(184467 ret i8* %a } +define void @f41(i8* align 32, double* align 64) { +; CHECK: define void @f41(i8* align 32, double* align 64) { + ret void +} + ; CHECK: attributes #0 = { noreturn } ; CHECK: attributes #1 = { nounwind } ; CHECK: attributes #2 = { readnone } -- cgit v1.2.3