new @llvm.memcpy and @llvm.memset API in trunk - how to use alignment?

The new @llvm.memcpy API does not have an alignment parameter. Instead the docs say to use the align attribute. How is this supposed to work with different alignments?

For example, I have one memcpy with align 4, align 4, and another with align 1, align 1.

; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly align 4, i8* nocapture readonly align 4, i64, i1) #3

; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64.1(i8* nocapture writeonly align 1, i8* nocapture readonly align 1, i64, i1) #3

When I add these multiple definitions to the module, llvm mangles the name, adding .1 to the second one, and I get “Intrinsic name not mangled correctly for type arguments!”

What’s the correct way to do this?

Thanks,

Andrew

You're not supposed to add the alignment to the function declaration; just add it to the call itself. (If you're using IRBuilder, CreateMemCpy will take care of this for you.)

-Eli

IRBuilder::CreateMemCpy worked great, thanks!