1; RUN: opt -passes=name-anon-globals -module-summary < %s | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=BC 2; Check for summary block/records. 3 4; BC: <SOURCE_FILENAME 5; "h" 6; BC-NEXT: <GLOBALVAR {{.*}} op0=0 op1=1 7; "foo" 8; BC-NEXT: <FUNCTION op0=1 op1=3 9; "bar" 10; BC-NEXT: <FUNCTION op0=4 op1=3 11; "anon.[32 chars].0" 12; BC-NEXT: <FUNCTION op0=7 op1=39 13; "variadic" 14; BC-NEXT: <FUNCTION op0=46 op1=8 15; "llvm.va_start" 16; BC-NEXT: <FUNCTION op0=54 op1=13 17; "f" 18; BC-NEXT: <ALIAS op0=67 op1=1 19; BC: <GLOBALVAL_SUMMARY_BLOCK 20; BC-NEXT: <VERSION 21; BC-NEXT: <FLAGS 22; BC-NEXT: <PERMODULE {{.*}} op0=1 op1=0 23; BC-NEXT: <PERMODULE {{.*}} op0=2 op1=0 24; BC-NEXT: <PERMODULE {{.*}} op0=3 op1=7 25; BC-NEXT: <PERMODULE {{.*}} op0=4 op1=0 op2=4 op3=0 26; BC-NEXT: <ALIAS {{.*}} op0=6 op1=0 op2=3 27; BC-NEXT: <BLOCK_COUNT op0=5/> 28; BC-NEXT: </GLOBALVAL_SUMMARY_BLOCK 29; BC: <STRTAB_BLOCK 30; BC-NEXT: blob data = 'hfoobaranon.{{................................}}.0variadicllvm.va_startf{{.*}}' 31 32 33; RUN: opt -passes=name-anon-globals -module-summary < %s | llvm-dis | FileCheck %s 34; Check that this round-trips correctly. 35 36; ModuleID = '<stdin>' 37target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 38target triple = "x86_64-unknown-linux-gnu" 39 40; CHECK: define i32 @foo() 41 42; Function Attrs: nounwind uwtable 43define i32 @foo() #0 { 44entry: 45 ret i32 1 46} 47 48; CHECK: define i32 @bar(i32 %x) 49 50; Function Attrs: nounwind uwtable 51define i32 @bar(i32 %x) #0 { 52entry: 53 ret i32 %x 54} 55 56; FIXME: Anonymous function and alias not currently in summary until 57; follow on fixes to rename anonymous globals and emit alias summary 58; entries are committed. 59; Check an anonymous function as well, since in that case only the alias 60; ends up in the value symbol table and having a summary. 61@f = alias void (), void ()* @0 ; <void ()*> [#uses=0] 62@h = external global void ()* ; <void ()*> [#uses=0] 63 64define internal void @0() nounwind { 65entry: 66 store void()* @0, void()** @h 67 br label %return 68 69return: ; preds = %entry 70 ret void 71} 72 73define i32 @variadic(...) { 74 %ap = alloca i8*, align 8 75 %ap.0 = bitcast i8** %ap to i8* 76 call void @llvm.va_start(i8* %ap.0) 77 ret i32 42 78} 79 80declare void @llvm.va_start(i8*) nounwind 81