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