unsafe fn add_attrs(
    context: LLVMContextRef,
    function: LLVMValueRef,
    attrs: &[LLVMExtAttribute],
    index: u32,
) {
    for attr in attrs {
        let name = CString::new(attr.to_string()).unwrap();
        let kind = LLVMGetEnumAttributeKindForName(name.as_ptr(), name.as_bytes().len());
        assert_ne!(kind, 0);

        let attr = LLVMCreateEnumAttribute(context, kind, 0);
        // This function uses parameter numbers 1..N
        LLVMAddAttributeAtIndex(function, index, attr);
    }
}
Add attributes on an LLVM function, parameter, or return value.

The `index` passed determines what the attribute is added on.
weld/src/codegen/llvm2/llvm_exts.rs