[clang] [llvm] [CodeGen][LLVM] Make the `va_list` related intrinsics generic. (PR #85460)

Alex Voicu via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 20 17:40:53 PDT 2024


================
@@ -700,10 +700,13 @@ class MSBuiltin<string name> {
 //===--------------- Variable Argument Handling Intrinsics ----------------===//
 //
 
-def int_vastart : DefaultAttrsIntrinsic<[], [llvm_ptr_ty], [], "llvm.va_start">;
-def int_vacopy  : DefaultAttrsIntrinsic<[], [llvm_ptr_ty, llvm_ptr_ty], [],
-                            "llvm.va_copy">;
-def int_vaend   : DefaultAttrsIntrinsic<[], [llvm_ptr_ty], [], "llvm.va_end">;
+def int_vastart : DefaultAttrsIntrinsic<[],
+                                        [llvm_anyptr_ty], [], "llvm.va_start">;
+def int_vacopy  : DefaultAttrsIntrinsic<[],
+                                        [llvm_anyptr_ty, llvm_anyptr_ty], [],
+                                        "llvm.va_copy">;
----------------
AlexVlx wrote:

Hmm, I did struggle a bit with this and admit that I'm not (yet) entirely convinced a valid (albeit hypothetical and admittedly odd) case couldn't be constructed. Consider e.g. having a `__builtin_va_list` declared at namespace / global scope. If a target uses an explicit, non-generic, AS, for globals, then the copy would be to/from a pointer to generic (or pointer to private) from/to a pointer to global. I _believe_ this should work, and making `va_copy` mono-parameter would break it, would it not?

https://github.com/llvm/llvm-project/pull/85460


More information about the cfe-commits mailing list