[llvm] r225302 - Change the .ll syntax for comdats and add a syntactic sugar.

Rafael Espindola rafael.espindola at gmail.com
Tue Jan 6 14:55:16 PST 2015


Author: rafael
Date: Tue Jan  6 16:55:16 2015
New Revision: 225302

URL: http://llvm.org/viewvc/llvm-project?rev=225302&view=rev
Log:
Change the .ll syntax for comdats and add a syntactic sugar.

In order to make comdats always explicit in the IR, we decided to make
the syntax a bit more compact for the case of a GlobalObject in a
comdat with the same name.

Just dropping the $name causes problems for

@foo = globabl i32 0, comdat
$bar = comdat ...

and

declare void @foo() comdat
$bar = comdat ...

So the syntax is changed to

@g1 = globabl i32 0, comdat($c1)
@g2 = globabl i32 0, comdat

and

declare void @foo() comdat($c1)
declare void @foo() comdat

Added:
    llvm/trunk/test/Assembler/unnamed-comdat.ll
Modified:
    llvm/trunk/docs/LangRef.rst
    llvm/trunk/lib/AsmParser/LLParser.cpp
    llvm/trunk/lib/AsmParser/LLParser.h
    llvm/trunk/lib/IR/AsmWriter.cpp
    llvm/trunk/test/Assembler/invalid-comdat.ll
    llvm/trunk/test/CodeGen/X86/coff-comdat.ll
    llvm/trunk/test/CodeGen/X86/coff-comdat2.ll
    llvm/trunk/test/CodeGen/X86/coff-comdat3.ll
    llvm/trunk/test/CodeGen/X86/elf-comdat.ll
    llvm/trunk/test/CodeGen/X86/elf-comdat2.ll
    llvm/trunk/test/CodeGen/X86/macho-comdat.ll
    llvm/trunk/test/Feature/comdat.ll
    llvm/trunk/test/Instrumentation/AddressSanitizer/do-not-touch-comdat-global.ll
    llvm/trunk/test/Linker/Inputs/comdat.ll
    llvm/trunk/test/Linker/Inputs/comdat2.ll
    llvm/trunk/test/Linker/Inputs/comdat3.ll
    llvm/trunk/test/Linker/Inputs/comdat4.ll
    llvm/trunk/test/Linker/Inputs/comdat5.ll
    llvm/trunk/test/Linker/Inputs/comdat8.ll
    llvm/trunk/test/Linker/Inputs/visibility.ll
    llvm/trunk/test/Linker/comdat.ll
    llvm/trunk/test/Linker/comdat2.ll
    llvm/trunk/test/Linker/comdat3.ll
    llvm/trunk/test/Linker/comdat4.ll
    llvm/trunk/test/Linker/comdat5.ll
    llvm/trunk/test/Linker/comdat6.ll
    llvm/trunk/test/Linker/comdat7.ll
    llvm/trunk/test/Linker/comdat8.ll
    llvm/trunk/test/Linker/comdat9.ll
    llvm/trunk/test/Linker/constructor-comdat.ll
    llvm/trunk/test/Linker/visibility.ll
    llvm/trunk/test/Transforms/GlobalDCE/pr20981.ll
    llvm/trunk/test/Transforms/GlobalOpt/pr21191.ll
    llvm/trunk/test/Transforms/GlobalOpt/preserve-comdats.ll
    llvm/trunk/test/Transforms/Inline/pr21206.ll
    llvm/trunk/test/Verifier/comdat.ll
    llvm/trunk/test/Verifier/comdat2.ll
    llvm/trunk/test/tools/gold/Inputs/comdat.ll
    llvm/trunk/test/tools/gold/comdat.ll

Modified: llvm/trunk/docs/LangRef.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.rst?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.rst (original)
+++ llvm/trunk/docs/LangRef.rst Tue Jan  6 16:55:16 2015
@@ -596,7 +596,8 @@ Syntax::
     [@<GlobalVarName> =] [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal]
                          [unnamed_addr] [AddrSpace] [ExternallyInitialized]
                          <global | constant> <Type> [<InitializerConstant>]
-                         [, section "name"] [, align <Alignment>]
+                         [, section "name"] [, comdat [($name)]]
+                         [, align <Alignment>]
 
 For example, the following defines a global in a numbered address space
 with an initializer, section, and alignment:
@@ -681,7 +682,7 @@ Syntax::
     define [linkage] [visibility] [DLLStorageClass]
            [cconv] [ret attrs]
            <ResultType> @<FunctionName> ([argument list])
-           [unnamed_addr] [fn Attrs] [section "name"] [comdat $<ComdatName>]
+           [unnamed_addr] [fn Attrs] [section "name"] [comdat [($name)]]
            [align N] [gc] [prefix Constant] [prologue Constant] { ... }
 
 The argument list is a comma seperated sequence of arguments where each
@@ -775,12 +776,21 @@ the COMDAT key's section is the largest:
 .. code-block:: llvm
 
    $foo = comdat largest
-   @foo = global i32 2, comdat $foo
+   @foo = global i32 2, comdat($foo)
 
-   define void @bar() comdat $foo {
+   define void @bar() comdat($foo) {
      ret void
    }
 
+As a syntactic sugar the ``$name`` can be omitted if the name is the same as
+the global name:
+
+.. code-block:: llvm
+
+  $foo = comdat any
+  @foo = global i32 2, comdat
+
+
 In a COFF object file, this will create a COMDAT section with selection kind
 ``IMAGE_COMDAT_SELECT_LARGEST`` containing the contents of the ``@foo`` symbol
 and another COMDAT section with selection kind
@@ -803,8 +813,8 @@ For example:
 
    $foo = comdat any
    $bar = comdat any
-   @g1 = global i32 42, section "sec", comdat $foo
-   @g2 = global i32 42, section "sec", comdat $bar
+   @g1 = global i32 42, section "sec", comdat($foo)
+   @g2 = global i32 42, section "sec", comdat($bar)
 
 From the object file perspective, this requires the creation of two sections
 with the same name.  This is necessary because both globals belong to different

Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Jan  6 16:55:16 2015
@@ -850,7 +850,7 @@ bool LLParser::ParseGlobal(const std::st
       GV->setAlignment(Alignment);
     } else {
       Comdat *C;
-      if (parseOptionalComdat(C))
+      if (parseOptionalComdat(Name, C))
         return true;
       if (C)
         GV->setComdat(C);
@@ -2899,16 +2899,26 @@ bool LLParser::ParseGlobalTypeAndValue(C
          ParseGlobalValue(Ty, V);
 }
 
-bool LLParser::parseOptionalComdat(Comdat *&C) {
+bool LLParser::parseOptionalComdat(StringRef GlobalName, Comdat *&C) {
   C = nullptr;
+
+  LocTy KwLoc = Lex.getLoc();
   if (!EatIfPresent(lltok::kw_comdat))
     return false;
-  if (Lex.getKind() != lltok::ComdatVar)
-    return TokError("expected comdat variable");
-  LocTy Loc = Lex.getLoc();
-  StringRef Name = Lex.getStrVal();
-  C = getComdat(Name, Loc);
-  Lex.Lex();
+
+  if (EatIfPresent(lltok::lparen)) {
+    if (Lex.getKind() != lltok::ComdatVar)
+      return TokError("expected comdat variable");
+    C = getComdat(Lex.getStrVal(), Lex.getLoc());
+    Lex.Lex();
+    if (ParseToken(lltok::rparen, "expected ')' after comdat var"))
+      return true;
+  } else {
+    if (GlobalName.empty())
+      return TokError("comdat cannot be unnamed");
+    C = getComdat(GlobalName, KwLoc);
+  }
+
   return false;
 }
 
@@ -3262,7 +3272,7 @@ bool LLParser::ParseFunctionHeader(Funct
                                  BuiltinLoc) ||
       (EatIfPresent(lltok::kw_section) &&
        ParseStringConstant(Section)) ||
-      parseOptionalComdat(C) ||
+      parseOptionalComdat(FunctionName, C) ||
       ParseOptionalAlignment(Alignment) ||
       (EatIfPresent(lltok::kw_gc) &&
        ParseStringConstant(GC)) ||

Modified: llvm/trunk/lib/AsmParser/LLParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.h (original)
+++ llvm/trunk/lib/AsmParser/LLParser.h Tue Jan  6 16:55:16 2015
@@ -385,7 +385,7 @@ namespace llvm {
     bool ParseGlobalValue(Type *Ty, Constant *&V);
     bool ParseGlobalTypeAndValue(Constant *&V);
     bool ParseGlobalValueVector(SmallVectorImpl<Constant *> &Elts);
-    bool parseOptionalComdat(Comdat *&C);
+    bool parseOptionalComdat(StringRef GlobalName, Comdat *&C);
     bool ParseMetadataAsValue(Value *&V, PerFunctionState &PFS);
     bool ParseValueAsMetadata(Metadata *&MD, PerFunctionState *PFS);
     bool ParseMetadata(Metadata *&MD, PerFunctionState *PFS);

Modified: llvm/trunk/lib/IR/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AsmWriter.cpp (original)
+++ llvm/trunk/lib/IR/AsmWriter.cpp Tue Jan  6 16:55:16 2015
@@ -1683,6 +1683,24 @@ static void PrintThreadLocalModel(Global
   }
 }
 
+static void maybePrintComdat(formatted_raw_ostream &Out,
+                             const GlobalObject &GO) {
+  const Comdat *C = GO.getComdat();
+  if (!C)
+    return;
+
+  if (isa<GlobalVariable>(GO))
+    Out << ',';
+  Out << " comdat";
+
+  if (GO.getName() == C->getName())
+    return;
+
+  Out << '(';
+  PrintLLVMName(Out, C->getName(), ComdatPrefix);
+  Out << ')';
+}
+
 void AssemblyWriter::printGlobal(const GlobalVariable *GV) {
   if (GV->isMaterializable())
     Out << "; Materializable\n";
@@ -1716,10 +1734,7 @@ void AssemblyWriter::printGlobal(const G
     PrintEscapedString(GV->getSection(), Out);
     Out << '"';
   }
-  if (GV->hasComdat()) {
-    Out << ", comdat ";
-    PrintLLVMName(Out, GV->getComdat()->getName(), ComdatPrefix);
-  }
+  maybePrintComdat(Out, *GV);
   if (GV->getAlignment())
     Out << ", align " << GV->getAlignment();
 
@@ -1900,10 +1915,7 @@ void AssemblyWriter::printFunction(const
     PrintEscapedString(F->getSection(), Out);
     Out << '"';
   }
-  if (F->hasComdat()) {
-    Out << " comdat ";
-    PrintLLVMName(Out, F->getComdat()->getName(), ComdatPrefix);
-  }
+  maybePrintComdat(Out, *F);
   if (F->getAlignment())
     Out << " align " << F->getAlignment();
   if (F->hasGC())

Modified: llvm/trunk/test/Assembler/invalid-comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/invalid-comdat.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Assembler/invalid-comdat.ll (original)
+++ llvm/trunk/test/Assembler/invalid-comdat.ll Tue Jan  6 16:55:16 2015
@@ -1,4 +1,4 @@
 ; RUN: not llvm-as < %s 2>&1 | FileCheck %s
 
- at v = global i32 0, comdat $v
+ at v = global i32 0, comdat($v)
 ; CHECK: use of undefined comdat '$v'

Added: llvm/trunk/test/Assembler/unnamed-comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/unnamed-comdat.ll?rev=225302&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/unnamed-comdat.ll (added)
+++ llvm/trunk/test/Assembler/unnamed-comdat.ll Tue Jan  6 16:55:16 2015
@@ -0,0 +1,6 @@
+; RUN: not llvm-as < %s 2>&1 | FileCheck %s
+; CHECK: comdat cannot be unnamed
+
+define void @0() comdat {
+  ret void
+}

Modified: llvm/trunk/test/CodeGen/X86/coff-comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/coff-comdat.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/coff-comdat.ll (original)
+++ llvm/trunk/test/CodeGen/X86/coff-comdat.ll Tue Jan  6 16:55:16 2015
@@ -1,58 +1,58 @@
 ; RUN: llc -mtriple i386-pc-win32 < %s | FileCheck %s
 
 $f1 = comdat any
- at v1 = global i32 0, comdat $f1
-define void @f1() comdat $f1 {
+ at v1 = global i32 0, comdat($f1)
+define void @f1() comdat($f1) {
   ret void
 }
 
 $f2 = comdat exactmatch
- at v2 = global i32 0, comdat $f2
-define void @f2() comdat $f2 {
+ at v2 = global i32 0, comdat($f2)
+define void @f2() comdat($f2) {
   ret void
 }
 
 $f3 = comdat largest
- at v3 = global i32 0, comdat $f3
-define void @f3() comdat $f3 {
+ at v3 = global i32 0, comdat($f3)
+define void @f3() comdat($f3) {
   ret void
 }
 
 $f4 = comdat noduplicates
- at v4 = global i32 0, comdat $f4
-define void @f4() comdat $f4 {
+ at v4 = global i32 0, comdat($f4)
+define void @f4() comdat($f4) {
   ret void
 }
 
 $f5 = comdat samesize
- at v5 = global i32 0, comdat $f5
-define void @f5() comdat $f5 {
+ at v5 = global i32 0, comdat($f5)
+define void @f5() comdat($f5) {
   ret void
 }
 
 $f6 = comdat samesize
- at v6 = global i32 0, comdat $f6
- at f6 = global i32 0, comdat $f6
+ at v6 = global i32 0, comdat($f6)
+ at f6 = global i32 0, comdat($f6)
 
 $"\01 at f7@0" = comdat any
-define x86_fastcallcc void @"\01 at v7@0"() comdat $"\01 at f7@0" {
+define x86_fastcallcc void @"\01 at v7@0"() comdat($"\01 at f7@0") {
   ret void
 }
-define x86_fastcallcc void @"\01 at f7@0"() comdat $"\01 at f7@0" {
+define x86_fastcallcc void @"\01 at f7@0"() comdat($"\01 at f7@0") {
   ret void
 }
 
 $f8 = comdat any
-define x86_fastcallcc void @v8() comdat $f8 {
+define x86_fastcallcc void @v8() comdat($f8) {
   ret void
 }
-define x86_fastcallcc void @f8() comdat $f8 {
+define x86_fastcallcc void @f8() comdat($f8) {
   ret void
 }
 
 $vftable = comdat largest
 
- at some_name = private unnamed_addr constant [2 x i8*] zeroinitializer, comdat $vftable
+ at some_name = private unnamed_addr constant [2 x i8*] zeroinitializer, comdat($vftable)
 @vftable = alias getelementptr([2 x i8*]* @some_name, i32 0, i32 1)
 
 ; CHECK: .section        .text,"xr",discard,_f1

Modified: llvm/trunk/test/CodeGen/X86/coff-comdat2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/coff-comdat2.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/coff-comdat2.ll (original)
+++ llvm/trunk/test/CodeGen/X86/coff-comdat2.ll Tue Jan  6 16:55:16 2015
@@ -5,5 +5,5 @@ target triple = "i686-pc-windows-msvc"
 
 $foo = comdat largest
 @foo = global i32 0
- at bar = global i32 0, comdat $foo
+ at bar = global i32 0, comdat($foo)
 ; CHECK: Associative COMDAT symbol 'foo' is not a key for its COMDAT.

Modified: llvm/trunk/test/CodeGen/X86/coff-comdat3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/coff-comdat3.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/coff-comdat3.ll (original)
+++ llvm/trunk/test/CodeGen/X86/coff-comdat3.ll Tue Jan  6 16:55:16 2015
@@ -4,5 +4,5 @@ target datalayout = "e-m:w-p:32:32-i64:6
 target triple = "i686-pc-windows-msvc"
 
 $foo = comdat largest
- at bar = global i32 0, comdat $foo
+ at bar = global i32 0, comdat($foo)
 ; CHECK: Associative COMDAT symbol 'foo' does not exist.

Modified: llvm/trunk/test/CodeGen/X86/elf-comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/elf-comdat.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/elf-comdat.ll (original)
+++ llvm/trunk/test/CodeGen/X86/elf-comdat.ll Tue Jan  6 16:55:16 2015
@@ -1,8 +1,8 @@
 ; RUN: llc -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s
 
 $f = comdat any
- at v = global i32 0, comdat $f
-define void @f() comdat $f {
+ at v = global i32 0, comdat($f)
+define void @f() comdat($f) {
   ret void
 }
 ; CHECK: .section        .text.f,"axG", at progbits,f,comdat

Modified: llvm/trunk/test/CodeGen/X86/elf-comdat2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/elf-comdat2.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/elf-comdat2.ll (original)
+++ llvm/trunk/test/CodeGen/X86/elf-comdat2.ll Tue Jan  6 16:55:16 2015
@@ -1,7 +1,7 @@
 ; RUN: llc -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s
 
 $foo = comdat any
- at bar = global i32 42, comdat $foo
+ at bar = global i32 42, comdat($foo)
 @foo = global i32 42
 
 ; CHECK:      .type   bar, at object

Modified: llvm/trunk/test/CodeGen/X86/macho-comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/macho-comdat.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/macho-comdat.ll (original)
+++ llvm/trunk/test/CodeGen/X86/macho-comdat.ll Tue Jan  6 16:55:16 2015
@@ -2,5 +2,5 @@
 ; RUN: FileCheck < %t %s
 
 $f = comdat any
- at v = global i32 0, comdat $f
+ at v = global i32 0, comdat($f)
 ; CHECK: LLVM ERROR: MachO doesn't support COMDATs, 'f' cannot be lowered.

Modified: llvm/trunk/test/Feature/comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/comdat.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Feature/comdat.ll (original)
+++ llvm/trunk/test/Feature/comdat.ll Tue Jan  6 16:55:16 2015
@@ -6,16 +6,16 @@ $f = comdat any
 $f2 = comdat any
 ; CHECK-NOT: f2
 
- at v = global i32 0, comdat $f
-; CHECK: @v = global i32 0, comdat $f
+ at v = global i32 0, comdat($f)
+; CHECK: @v = global i32 0, comdat($f)
 
 @a = alias i32* @v
 ; CHECK: @a = alias i32* @v{{$}}
 
-define void @f() comdat $f {
+define void @f() comdat($f) {
   ret void
 }
-; CHECK: define void @f() comdat $f
+; CHECK: define void @f() comdat {
 
 $i = comdat largest
- at i = internal global i32 0, comdat $i
+ at i = internal global i32 0, comdat($i)

Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/do-not-touch-comdat-global.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/do-not-touch-comdat-global.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/do-not-touch-comdat-global.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/do-not-touch-comdat-global.ll Tue Jan  6 16:55:16 2015
@@ -5,7 +5,7 @@ target datalayout = "e-m:w-p:32:32-i64:6
 target triple = "i686-pc-windows-msvc"
 ; no action should be taken for these globals
 $global_noinst = comdat largest
- at aliasee = private unnamed_addr constant [2 x i8] [i8 1, i8 2], comdat $global_noinst
+ at aliasee = private unnamed_addr constant [2 x i8] [i8 1, i8 2], comdat($global_noinst)
 @global_noinst = unnamed_addr alias [2 x i8]* @aliasee
 ; CHECK-NOT: {{asan_gen.*global_noinst}}
 ; CHECK-DAG: @global_noinst = unnamed_addr alias [2 x i8]* @aliasee

Modified: llvm/trunk/test/Linker/Inputs/comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/Inputs/comdat.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/Inputs/comdat.ll (original)
+++ llvm/trunk/test/Linker/Inputs/comdat.ll Tue Jan  6 16:55:16 2015
@@ -2,19 +2,19 @@ target datalayout = "e-m:w-p:32:32-i64:6
 target triple = "i686-pc-windows-msvc"
 
 $foo = comdat largest
- at foo = global i64 43, comdat $foo
+ at foo = global i64 43, comdat($foo)
 
-define i32 @bar() comdat $foo {
+define i32 @bar() comdat($foo) {
   ret i32 43
 }
 
 $qux = comdat largest
- at qux = global i32 13, comdat $qux
- at in_unselected_group = global i32 13, comdat $qux
+ at qux = global i32 13, comdat($qux)
+ at in_unselected_group = global i32 13, comdat($qux)
 
-define i32 @baz() comdat $qux {
+define i32 @baz() comdat($qux) {
   ret i32 13
 }
 
 $any = comdat any
- at any = global i64 7, comdat $any
+ at any = global i64 7, comdat($any)

Modified: llvm/trunk/test/Linker/Inputs/comdat2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/Inputs/comdat2.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/Inputs/comdat2.ll (original)
+++ llvm/trunk/test/Linker/Inputs/comdat2.ll Tue Jan  6 16:55:16 2015
@@ -1,2 +1,2 @@
 $foo = comdat largest
- at foo = global i64 43, comdat $foo
+ at foo = global i64 43, comdat($foo)

Modified: llvm/trunk/test/Linker/Inputs/comdat3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/Inputs/comdat3.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/Inputs/comdat3.ll (original)
+++ llvm/trunk/test/Linker/Inputs/comdat3.ll Tue Jan  6 16:55:16 2015
@@ -1,2 +1,2 @@
 $foo = comdat noduplicates
- at foo = global i64 43, comdat $foo
+ at foo = global i64 43, comdat($foo)

Modified: llvm/trunk/test/Linker/Inputs/comdat4.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/Inputs/comdat4.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/Inputs/comdat4.ll (original)
+++ llvm/trunk/test/Linker/Inputs/comdat4.ll Tue Jan  6 16:55:16 2015
@@ -2,4 +2,4 @@ target datalayout = "e-m:w-p:32:32-i64:6
 target triple = "i686-pc-windows-msvc"
 
 $foo = comdat samesize
- at foo = global i64 42, comdat $foo
+ at foo = global i64 42, comdat($foo)

Modified: llvm/trunk/test/Linker/Inputs/comdat5.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/Inputs/comdat5.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/Inputs/comdat5.ll (original)
+++ llvm/trunk/test/Linker/Inputs/comdat5.ll Tue Jan  6 16:55:16 2015
@@ -3,7 +3,7 @@ target datalayout = "e-m:w-p:32:32-i64:6
 $foo = comdat largest
 
 @zed = external constant i8
- at some_name = private unnamed_addr constant [2 x i8*] [i8* @zed, i8* bitcast (void ()* @bar to i8*)], comdat $foo
+ at some_name = private unnamed_addr constant [2 x i8*] [i8* @zed, i8* bitcast (void ()* @bar to i8*)], comdat($foo)
 @foo = alias getelementptr([2 x i8*]* @some_name, i32 0, i32 1)
 
 declare void @bar() unnamed_addr

Modified: llvm/trunk/test/Linker/Inputs/comdat8.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/Inputs/comdat8.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/Inputs/comdat8.ll (original)
+++ llvm/trunk/test/Linker/Inputs/comdat8.ll Tue Jan  6 16:55:16 2015
@@ -1,4 +1,4 @@
 $c1 = comdat largest
 
- at some_name = private unnamed_addr constant i32 42, comdat $c1
+ at some_name = private unnamed_addr constant i32 42, comdat($c1)
 @c1 = alias i32* @some_name

Modified: llvm/trunk/test/Linker/Inputs/visibility.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/Inputs/visibility.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/Inputs/visibility.ll (original)
+++ llvm/trunk/test/Linker/Inputs/visibility.ll Tue Jan  6 16:55:16 2015
@@ -4,7 +4,7 @@ $c1 = comdat any
 @v1 = weak hidden global i32 0
 @v2 = weak protected global i32 0
 @v3 = weak hidden global i32 0
- at v4 = hidden global i32 1, comdat $c1
+ at v4 = hidden global i32 1, comdat($c1)
 
 ; Aliases
 @a1 = weak hidden alias i32* @v1

Modified: llvm/trunk/test/Linker/comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/comdat.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/comdat.ll (original)
+++ llvm/trunk/test/Linker/comdat.ll Tue Jan  6 16:55:16 2015
@@ -3,30 +3,30 @@ target datalayout = "e-m:w-p:32:32-i64:6
 target triple = "i686-pc-windows-msvc"
 
 $foo = comdat largest
- at foo = global i32 42, comdat $foo
+ at foo = global i32 42, comdat($foo)
 
-define i32 @bar() comdat $foo {
+define i32 @bar() comdat($foo) {
   ret i32 42
 }
 
 $qux = comdat largest
- at qux = global i64 12, comdat $qux
+ at qux = global i64 12, comdat($qux)
 
-define i32 @baz() comdat $qux {
+define i32 @baz() comdat($qux) {
   ret i32 12
 }
 
 $any = comdat any
- at any = global i64 6, comdat $any
+ at any = global i64 6, comdat($any)
 
 ; CHECK: $qux = comdat largest
 ; CHECK: $foo = comdat largest
 ; CHECK: $any = comdat any
 
-; CHECK: @qux = global i64 12, comdat $qux
-; CHECK: @any = global i64 6, comdat $any
-; CHECK: @foo = global i64 43, comdat $foo
+; CHECK: @qux = global i64 12, comdat{{$}}
+; CHECK: @any = global i64 6, comdat{{$}}
+; CHECK: @foo = global i64 43, comdat{{$}}
 ; CHECK-NOT: @in_unselected_group = global i32 13, comdat $qux
 
-; CHECK: define i32 @baz() comdat $qux
-; CHECK: define i32 @bar() comdat $foo
+; CHECK: define i32 @baz() comdat($qux)
+; CHECK: define i32 @bar() comdat($foo)

Modified: llvm/trunk/test/Linker/comdat2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/comdat2.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/comdat2.ll (original)
+++ llvm/trunk/test/Linker/comdat2.ll Tue Jan  6 16:55:16 2015
@@ -3,5 +3,5 @@ target datalayout = "e-m:w-p:32:32-i64:6
 target triple = "i686-pc-windows-msvc"
 
 $foo = comdat samesize
- at foo = global i32 42, comdat $foo
+ at foo = global i32 42, comdat($foo)
 ; CHECK: Linking COMDATs named 'foo': invalid selection kinds!

Modified: llvm/trunk/test/Linker/comdat3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/comdat3.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/comdat3.ll (original)
+++ llvm/trunk/test/Linker/comdat3.ll Tue Jan  6 16:55:16 2015
@@ -1,5 +1,5 @@
 ; RUN: not llvm-link %s %p/Inputs/comdat2.ll -S -o - 2>&1 | FileCheck %s
 
 $foo = comdat largest
- at foo = global i32 43, comdat $foo
+ at foo = global i32 43, comdat($foo)
 ; CHECK: Linking COMDATs named 'foo': can't do size dependent selection without DataLayout!

Modified: llvm/trunk/test/Linker/comdat4.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/comdat4.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/comdat4.ll (original)
+++ llvm/trunk/test/Linker/comdat4.ll Tue Jan  6 16:55:16 2015
@@ -1,5 +1,5 @@
 ; RUN: not llvm-link %s %p/Inputs/comdat3.ll -S -o - 2>&1 | FileCheck %s
 
 $foo = comdat noduplicates
- at foo = global i64 43, comdat $foo
+ at foo = global i64 43, comdat($foo)
 ; CHECK: Linking COMDATs named 'foo': noduplicates has been violated!

Modified: llvm/trunk/test/Linker/comdat5.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/comdat5.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/comdat5.ll (original)
+++ llvm/trunk/test/Linker/comdat5.ll Tue Jan  6 16:55:16 2015
@@ -3,5 +3,5 @@ target datalayout = "e-m:w-p:32:32-i64:6
 target triple = "i686-pc-windows-msvc"
 
 $foo = comdat samesize
- at foo = global i32 42, comdat $foo
+ at foo = global i32 42, comdat($foo)
 ; CHECK: Linking COMDATs named 'foo': SameSize violated!

Modified: llvm/trunk/test/Linker/comdat6.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/comdat6.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/comdat6.ll (original)
+++ llvm/trunk/test/Linker/comdat6.ll Tue Jan  6 16:55:16 2015
@@ -3,7 +3,7 @@
 target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
 
 $foo = comdat largest
- at foo = linkonce_odr unnamed_addr constant [1 x i8*] [i8* bitcast (void ()* @bar to i8*)], comdat $foo
+ at foo = linkonce_odr unnamed_addr constant [1 x i8*] [i8* bitcast (void ()* @bar to i8*)], comdat($foo)
 
 ; CHECK: @foo = alias getelementptr inbounds ([2 x i8*]* @some_name, i32 0, i32 1)
 

Modified: llvm/trunk/test/Linker/comdat7.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/comdat7.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/comdat7.ll (original)
+++ llvm/trunk/test/Linker/comdat7.ll Tue Jan  6 16:55:16 2015
@@ -2,7 +2,7 @@
 
 $c1 = comdat largest
 
-define void @c1() comdat $c1 {
+define void @c1() comdat($c1) {
   ret void
 }
 ; CHECK: GlobalVariable required for data dependent selection!

Modified: llvm/trunk/test/Linker/comdat8.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/comdat8.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/comdat8.ll (original)
+++ llvm/trunk/test/Linker/comdat8.ll Tue Jan  6 16:55:16 2015
@@ -2,7 +2,7 @@
 
 $c1 = comdat largest
 
- at some_name = private unnamed_addr constant i32 42, comdat $c1
+ at some_name = private unnamed_addr constant i32 42, comdat($c1)
 @c1 = alias i8* inttoptr (i32 ptrtoint (i32* @some_name to i32) to i8*)
 
 ; CHECK: COMDAT key involves incomputable alias size.

Modified: llvm/trunk/test/Linker/comdat9.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/comdat9.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/comdat9.ll (original)
+++ llvm/trunk/test/Linker/comdat9.ll Tue Jan  6 16:55:16 2015
@@ -2,18 +2,18 @@
 
 $c = comdat any
 @a = alias void ()* @f
-define internal void @f() comdat $c {
+define internal void @f() comdat($c) {
   ret void
 }
 
 ; CHECK-DAG: $c = comdat any
 ; CHECK-DAG: @a = alias void ()* @f
-; CHECK-DAG: define internal void @f() comdat $c
+; CHECK-DAG: define internal void @f() comdat($c)
 
 $f2 = comdat largest
-define internal void @f2() comdat $f2 {
+define internal void @f2() comdat($f2) {
   ret void
 }
 
 ; CHECK-DAG: $f2 = comdat largest
-; CHECK-DAG: define internal void @f2() comdat $f2
+; CHECK-DAG: define internal void @f2() comdat {

Modified: llvm/trunk/test/Linker/constructor-comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/constructor-comdat.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/constructor-comdat.ll (original)
+++ llvm/trunk/test/Linker/constructor-comdat.ll Tue Jan  6 16:55:16 2015
@@ -7,7 +7,7 @@ $_ZN3fooIiEC5Ev = comdat any
 @_ZN3fooIiEC1Ev = weak_odr alias void ()* @_ZN3fooIiEC2Ev
 ; CHECK: @_ZN3fooIiEC1Ev = weak_odr alias void ()* @_ZN3fooIiEC2Ev
 
-; CHECK: define weak_odr void @_ZN3fooIiEC2Ev() comdat $_ZN3fooIiEC5Ev {
-define weak_odr void @_ZN3fooIiEC2Ev() comdat $_ZN3fooIiEC5Ev {
+; CHECK: define weak_odr void @_ZN3fooIiEC2Ev() comdat($_ZN3fooIiEC5Ev) {
+define weak_odr void @_ZN3fooIiEC2Ev() comdat($_ZN3fooIiEC5Ev) {
   ret void
 }

Modified: llvm/trunk/test/Linker/visibility.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/visibility.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Linker/visibility.ll (original)
+++ llvm/trunk/test/Linker/visibility.ll Tue Jan  6 16:55:16 2015
@@ -17,8 +17,8 @@ $c1 = comdat any
 ; CHECK-DAG: @v3 = hidden global i32 0
 @v3 = protected global i32 0
 
-; CHECK-DAG: @v4 = hidden global i32 1, comdat $c1
- at v4 = global i32 1, comdat $c1
+; CHECK-DAG: @v4 = hidden global i32 1, comdat($c1)
+ at v4 = global i32 1, comdat($c1)
 
 ; Aliases
 ; CHECK: @a1 = hidden alias i32* @v1

Modified: llvm/trunk/test/Transforms/GlobalDCE/pr20981.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalDCE/pr20981.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/GlobalDCE/pr20981.ll (original)
+++ llvm/trunk/test/Transforms/GlobalDCE/pr20981.ll Tue Jan  6 16:55:16 2015
@@ -6,10 +6,10 @@ $c1 = comdat any
 @a1 = linkonce_odr alias void ()* @f1
 ; CHECK: @a1 = linkonce_odr alias void ()* @f1
 
-define linkonce_odr void @f1() comdat $c1 {
+define linkonce_odr void @f1() comdat($c1) {
   ret void
 }
-; CHECK: define linkonce_odr void @f1() comdat $c1
+; CHECK: define linkonce_odr void @f1() comdat($c1)
 
 define void @g() {
   call void @f1()

Modified: llvm/trunk/test/Transforms/GlobalOpt/pr21191.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/pr21191.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/GlobalOpt/pr21191.ll (original)
+++ llvm/trunk/test/Transforms/GlobalOpt/pr21191.ll Tue Jan  6 16:55:16 2015
@@ -3,15 +3,15 @@
 $c = comdat any
 ; CHECK: $c = comdat any
 
-define linkonce_odr void @foo() comdat $c {
+define linkonce_odr void @foo() comdat($c) {
   ret void
 }
-; CHECK: define linkonce_odr void @foo() comdat $c
+; CHECK: define linkonce_odr void @foo() comdat($c)
 
-define linkonce_odr void @bar() comdat $c {
+define linkonce_odr void @bar() comdat($c) {
   ret void
 }
-; CHECK: define linkonce_odr void @bar() comdat $c
+; CHECK: define linkonce_odr void @bar() comdat($c)
 
 define void @zed()  {
   call void @foo()

Modified: llvm/trunk/test/Transforms/GlobalOpt/preserve-comdats.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/preserve-comdats.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/GlobalOpt/preserve-comdats.ll (original)
+++ llvm/trunk/test/Transforms/GlobalOpt/preserve-comdats.ll Tue Jan  6 16:55:16 2015
@@ -2,9 +2,9 @@
 
 $comdat_global = comdat any
 
- at comdat_global = weak_odr global i8 0, comdat $comdat_global
+ at comdat_global = weak_odr global i8 0, comdat($comdat_global)
 @simple_global = internal global i8 0
-; CHECK: @comdat_global = weak_odr global i8 0, comdat $comdat_global
+; CHECK: @comdat_global = weak_odr global i8 0, comdat{{$}}
 ; CHECK: @simple_global = internal global i8 42
 
 @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [
@@ -20,7 +20,7 @@ define void @init_comdat_global() {
 }
 ; CHECK: define void @init_comdat_global()
 
-define internal void @init_simple_global() comdat $comdat_global {
+define internal void @init_simple_global() comdat($comdat_global) {
   store i8 42, i8* @simple_global
   ret void
 }

Modified: llvm/trunk/test/Transforms/Inline/pr21206.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/pr21206.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/pr21206.ll (original)
+++ llvm/trunk/test/Transforms/Inline/pr21206.ll Tue Jan  6 16:55:16 2015
@@ -3,15 +3,15 @@
 $c = comdat any
 ; CHECK: $c = comdat any
 
-define linkonce_odr void @foo() comdat $c {
+define linkonce_odr void @foo() comdat($c) {
   ret void
 }
-; CHECK: define linkonce_odr void @foo() comdat $c
+; CHECK: define linkonce_odr void @foo() comdat($c)
 
-define linkonce_odr void @bar() comdat $c {
+define linkonce_odr void @bar() comdat($c) {
   ret void
 }
-; CHECK: define linkonce_odr void @bar() comdat $c
+; CHECK: define linkonce_odr void @bar() comdat($c)
 
 define void()* @zed()  {
   ret void()* @foo

Modified: llvm/trunk/test/Verifier/comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/comdat.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Verifier/comdat.ll (original)
+++ llvm/trunk/test/Verifier/comdat.ll Tue Jan  6 16:55:16 2015
@@ -1,5 +1,5 @@
 ; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
 
 $v = comdat any
- at v = common global i32 0, comdat $v
+ at v = common global i32 0, comdat($v)
 ; CHECK: 'common' global may not be in a Comdat!

Modified: llvm/trunk/test/Verifier/comdat2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/comdat2.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/Verifier/comdat2.ll (original)
+++ llvm/trunk/test/Verifier/comdat2.ll Tue Jan  6 16:55:16 2015
@@ -1,5 +1,5 @@
 ; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
 
 $v = comdat any
- at v = private global i32 0, comdat $v
+ at v = private global i32 0, comdat($v)
 ; CHECK: comdat global value has private linkage

Modified: llvm/trunk/test/tools/gold/Inputs/comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/Inputs/comdat.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/tools/gold/Inputs/comdat.ll (original)
+++ llvm/trunk/test/tools/gold/Inputs/comdat.ll Tue Jan  6 16:55:16 2015
@@ -1,7 +1,7 @@
 $c2 = comdat any
 
- at v1 = weak_odr global i32 41, comdat $c2
-define weak_odr protected i32 @f1(i8* %this) comdat $c2 {
+ at v1 = weak_odr global i32 41, comdat($c2)
+define weak_odr protected i32 @f1(i8* %this) comdat($c2) {
 bb20:
   store i8* %this, i8** null
   br label %bb21

Modified: llvm/trunk/test/tools/gold/comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/comdat.ll?rev=225302&r1=225301&r2=225302&view=diff
==============================================================================
--- llvm/trunk/test/tools/gold/comdat.ll (original)
+++ llvm/trunk/test/tools/gold/comdat.ll Tue Jan  6 16:55:16 2015
@@ -6,8 +6,8 @@
 
 $c1 = comdat any
 
- at v1 = weak_odr global i32 42, comdat $c1
-define weak_odr i32 @f1(i8*) comdat $c1 {
+ at v1 = weak_odr global i32 42, comdat($c1)
+define weak_odr i32 @f1(i8*) comdat($c1) {
 bb10:
   br label %bb11
 bb11:
@@ -27,7 +27,7 @@ bb11:
 ; CHECK: $c1 = comdat any
 ; CHECK: $c2 = comdat any
 
-; CHECK: @v1 = weak_odr global i32 42, comdat $c1
+; CHECK: @v1 = weak_odr global i32 42, comdat($c1)
 
 ; CHECK: @r11 = global i32* @v1{{$}}
 ; CHECK: @r12 = global i32 (i8*)* @f1{{$}}
@@ -35,7 +35,7 @@ bb11:
 ; CHECK: @r21 = global i32* @v1{{$}}
 ; CHECK: @r22 = global i32 (i8*)* @f1{{$}}
 
-; CHECK: @v11 = internal global i32 41, comdat $c2
+; CHECK: @v11 = internal global i32 41, comdat($c2)
 
 ; CHECK: @a11 = alias i32* @v1{{$}}
 ; CHECK: @a12 = alias bitcast (i32* @v1 to i16*)
@@ -49,14 +49,14 @@ bb11:
 ; CHECK: @a23 = alias i32 (i8*)* @f12{{$}}
 ; CHECK: @a24 = alias bitcast (i32 (i8*)* @f12 to i16*)
 
-; CHECK:      define weak_odr protected i32 @f1(i8*) comdat $c1 {
+; CHECK:      define weak_odr protected i32 @f1(i8*) comdat($c1) {
 ; CHECK-NEXT: bb10:
 ; CHECK-NEXT:   br label %bb11{{$}}
 ; CHECK:      bb11:
 ; CHECK-NEXT:   ret i32 42
 ; CHECK-NEXT: }
 
-; CHECK:      define internal i32 @f12(i8* %this) comdat $c2 {
+; CHECK:      define internal i32 @f12(i8* %this) comdat($c2) {
 ; CHECK-NEXT: bb20:
 ; CHECK-NEXT:   store i8* %this, i8** null
 ; CHECK-NEXT:   br label %bb21





More information about the llvm-commits mailing list