[llvm-commits] [llvm-gcc-4.2] r49920 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Dan Gohman gohman at apple.com
Fri Apr 18 13:54:58 PDT 2008


Author: djg
Date: Fri Apr 18 15:54:58 2008
New Revision: 49920

URL: http://llvm.org/viewvc/llvm-project?rev=49920&view=rev
Log:
Fix llvm-gcc's translation of va_copy on x86-64 and other targets
that use struct va_lists. This fixes the llvm-gcc side of PR2230.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=49920&r1=49919&r2=49920&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Apr 18 15:54:58 2008
@@ -4992,18 +4992,16 @@
   Value *Arg1 = Emit(Arg1T, 0);   // Emit the address of the destination.
   // The second arg of llvm.va_copy is a pointer to a valist.
   Value *Arg2;
-  if (!isAggregateTreeType(TREE_TYPE(Arg2T))) {
+  if (!isAggregateTreeType(va_list_type_node)) {
     // Emit it as a value, then store it to a temporary slot.
     Value *V2 = Emit(Arg2T, 0);
     Arg2 = CreateTemporary(V2->getType());
     Builder.CreateStore(V2, Arg2);
   } else {
-    // If the target has aggregate valists, emit the srcval directly into a
-    // temporary.
-    const Type *VAListTy = cast<PointerType>(Arg1->getType())->getElementType();
-    MemRef DestLoc = CreateTempLoc(VAListTy);
-    Emit(Arg2T, &DestLoc);
-    Arg2 = DestLoc.Ptr;
+    // If the target has aggregate valists, then the second argument
+    // from GCC is the address of the source valist and we don't
+    // need to do anything special.
+    Arg2 = Emit(Arg2T, 0);
   }
 
   static const Type *VPTy = PointerType::getUnqual(Type::Int8Ty);





More information about the llvm-commits mailing list