[llvm-commits] [llvm] r100787 - in /llvm/trunk: lib/VMCore/AsmWriter.cpp test/FrontendC/2007-05-16-EmptyStruct.c test/Transforms/InstCombine/invariant.ll test/Transforms/SCCP/ipsccp-basic.ll

Dan Gohman gohman at apple.com
Thu Apr 8 11:03:05 PDT 2010


Author: djg
Date: Thu Apr  8 13:03:05 2010
New Revision: 100787

URL: http://llvm.org/viewvc/llvm-project?rev=100787&view=rev
Log:
Print empty structs as {} rather than { }.

Modified:
    llvm/trunk/lib/VMCore/AsmWriter.cpp
    llvm/trunk/test/FrontendC/2007-05-16-EmptyStruct.c
    llvm/trunk/test/Transforms/InstCombine/invariant.ll
    llvm/trunk/test/Transforms/SCCP/ipsccp-basic.ll

Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=100787&r1=100786&r2=100787&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Thu Apr  8 13:03:05 2010
@@ -227,13 +227,15 @@
     const StructType *STy = cast<StructType>(Ty);
     if (STy->isPacked())
       OS << '<';
-    OS << "{ ";
+    OS << '{';
     for (StructType::element_iterator I = STy->element_begin(),
          E = STy->element_end(); I != E; ++I) {
+      OS << ' ';
       CalcTypeName(*I, TypeStack, OS);
-      if (next(I) != STy->element_end())
+      if (next(I) == STy->element_end())
+        OS << ' ';
+      else
         OS << ',';
-      OS << ' ';
     }
     OS << '}';
     if (STy->isPacked())
@@ -242,13 +244,15 @@
   }
   case Type::UnionTyID: {
     const UnionType *UTy = cast<UnionType>(Ty);
-    OS << "union { ";
+    OS << "union {";
     for (StructType::element_iterator I = UTy->element_begin(),
          E = UTy->element_end(); I != E; ++I) {
+      OS << ' ';
       CalcTypeName(*I, TypeStack, OS);
-      if (next(I) != UTy->element_end())
+      if (next(I) == UTy->element_end())
+        OS << ' ';
+      else
         OS << ',';
-      OS << ' ';
     }
     OS << '}';
     break;

Modified: llvm/trunk/test/FrontendC/2007-05-16-EmptyStruct.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2007-05-16-EmptyStruct.c?rev=100787&r1=100786&r2=100787&view=diff
==============================================================================
--- llvm/trunk/test/FrontendC/2007-05-16-EmptyStruct.c (original)
+++ llvm/trunk/test/FrontendC/2007-05-16-EmptyStruct.c Thu Apr  8 13:03:05 2010
@@ -1,5 +1,5 @@
 // PR 1417
 
-// RUN: %llvmgcc -xc  %s -c -o - | llvm-dis | grep "struct.anon = type \{ \}"
+// RUN: %llvmgcc -xc  %s -c -o - | llvm-dis | grep "struct.anon = type \{\}"
 
 struct { } *X;

Modified: llvm/trunk/test/Transforms/InstCombine/invariant.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/invariant.ll?rev=100787&r1=100786&r2=100787&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/invariant.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/invariant.ll Thu Apr  8 13:03:05 2010
@@ -3,13 +3,13 @@
 
 declare void @g(i8*)
 
-declare { }* @llvm.invariant.start(i64, i8* nocapture) nounwind readonly
+declare {}* @llvm.invariant.start(i64, i8* nocapture) nounwind readonly
 
 define i8 @f() {
   %a = alloca i8                                  ; <i8*> [#uses=4]
   store i8 0, i8* %a
-  %i = call { }* @llvm.invariant.start(i64 1, i8* %a) ; <{ }*> [#uses=0]
-  ; CHECK: call { }* @llvm.invariant.start
+  %i = call {}* @llvm.invariant.start(i64 1, i8* %a) ; <{}*> [#uses=0]
+  ; CHECK: call {}* @llvm.invariant.start
   call void @g(i8* %a)
   %r = load i8* %a                                ; <i8> [#uses=1]
   ret i8 %r

Modified: llvm/trunk/test/Transforms/SCCP/ipsccp-basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SCCP/ipsccp-basic.ll?rev=100787&r1=100786&r2=100787&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SCCP/ipsccp-basic.ll (original)
+++ llvm/trunk/test/Transforms/SCCP/ipsccp-basic.ll Thu Apr  8 13:03:05 2010
@@ -188,7 +188,7 @@
     %X = call {} @test8a(i32 5, i32* %P)
     ret void
 ; CHECK: define void @test8b
-; CHECK-NEXT: call { } @test8a
+; CHECK-NEXT: call {} @test8a
 ; CHECK-NEXT: ret void
 }
 





More information about the llvm-commits mailing list