[PATCH] D118904: [clang][CodeGen] Use memory type representation in `va_arg`

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 4 03:11:10 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG42afaf7f472c: [clang][CodeGen] Use memory type representation in `va_arg` (authored by jansvoboda11).

Changed prior to commit:
  https://reviews.llvm.org/D118904?vs=405644&id=405909#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118904/new/

https://reviews.llvm.org/D118904

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGen/arm64-arguments.c


Index: clang/test/CodeGen/arm64-arguments.c
===================================================================
--- clang/test/CodeGen/arm64-arguments.c
+++ clang/test/CodeGen/arm64-arguments.c
@@ -196,6 +196,16 @@
     __builtin_va_end(ap);
     return ll;
 }
+_Bool t3(int i, ...) {
+  // CHECK: t3
+  __builtin_va_list ap;
+  __builtin_va_start(ap, i);
+  // CHECK:      %0 = va_arg {{.*}}* %ap, i8
+  // CHECK-NEXT: store i8 %0, i8* %varet, align 1
+  _Bool b = __builtin_va_arg(ap, _Bool);
+  __builtin_va_end(ap);
+  return b;
+}
 
 #include <arm_neon.h>
 
Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -709,7 +709,8 @@
            "Unexpected CoerceToType seen in arginfo in generic VAArg emitter!");
 
     Address Temp = CGF.CreateMemTemp(Ty, "varet");
-    Val = CGF.Builder.CreateVAArg(VAListAddr.getPointer(), CGF.ConvertType(Ty));
+    Val = CGF.Builder.CreateVAArg(VAListAddr.getPointer(),
+                                  CGF.ConvertTypeForMem(Ty));
     CGF.Builder.CreateStore(Val, Temp);
     return Temp;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118904.405909.patch
Type: text/x-patch
Size: 1170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220204/d00c09f2/attachment.bin>


More information about the cfe-commits mailing list