[llvm-commits] [llvm-gcc-4.2] r57035 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp

Dan Gohman gohman at apple.com
Fri Oct 3 15:38:10 PDT 2008


Author: djg
Date: Fri Oct  3 17:38:10 2008
New Revision: 57035

URL: http://llvm.org/viewvc/llvm-project?rev=57035&view=rev
Log:
Recognize the way that classify_argument handles empty
structs, and don't add padding return values in that
case. This prevents the multiple-return-value code from
emitting out-of-bounds loads in this case.

This fixes SingleSource/UnitTests/2006-01-23-UnionInit.c
on x86-64.

Modified:
    llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=57035&r1=57034&r2=57035&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Fri Oct  3 17:38:10 2008
@@ -1094,6 +1094,11 @@
   if (NumClasses == 1 && Class[0] == X86_64_INTEGER_CLASS)
      assert(0 && "This type does not need multiple return registers!");
 
+  // classify_argument uses a single X86_64_NO_CLASS as a special case for
+  // empty structs. Recognize it and don't add any return values in that
+  // case.
+  if (NumClasses == 1 && Class[0] == X86_64_NO_CLASS)
+     return;
 
   for (int i = 0; i < NumClasses; ++i) {
     switch (Class[i]) {





More information about the llvm-commits mailing list