2016-09-16 17:18:16 +00:00
|
|
|
; RUN: opt -name-anon-globals -module-summary < %s | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=BC
|
|
|
|
|
; RUN: opt -passes=name-anon-globals -module-summary < %s | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=BC
|
2016-03-15 00:04:37 +00:00
|
|
|
; Check for summary block/records.
|
2015-10-04 14:33:43 +00:00
|
|
|
|
2017-04-17 17:51:36 +00:00
|
|
|
; BC: <SOURCE_FILENAME
|
|
|
|
|
; "h"
|
|
|
|
|
; BC-NEXT: <GLOBALVAR {{.*}} op0=0 op1=1
|
|
|
|
|
; "foo"
|
|
|
|
|
; BC-NEXT: <FUNCTION op0=1 op1=3
|
|
|
|
|
; "bar"
|
|
|
|
|
; BC-NEXT: <FUNCTION op0=4 op1=3
|
|
|
|
|
; "anon.[32 chars].0"
|
|
|
|
|
; BC-NEXT: <FUNCTION op0=7 op1=39
|
|
|
|
|
; "variadic"
|
|
|
|
|
; BC-NEXT: <FUNCTION op0=46 op1=8
|
2018-11-14 19:30:13 +00:00
|
|
|
; "llvm.va_start"
|
|
|
|
|
; BC-NEXT: <FUNCTION op0=54 op1=13
|
2017-04-17 17:51:36 +00:00
|
|
|
; "f"
|
2018-11-14 19:30:13 +00:00
|
|
|
; BC-NEXT: <ALIAS op0=67 op1=1
|
2016-03-11 18:52:24 +00:00
|
|
|
; BC: <GLOBALVAL_SUMMARY_BLOCK
|
2016-04-24 03:18:11 +00:00
|
|
|
; BC-NEXT: <VERSION
|
2019-01-11 18:31:57 +00:00
|
|
|
; BC-NEXT: <FLAGS
|
2016-03-11 18:52:24 +00:00
|
|
|
; BC-NEXT: <PERMODULE {{.*}} op0=1 op1=0
|
|
|
|
|
; BC-NEXT: <PERMODULE {{.*}} op0=2 op1=0
|
2016-04-24 03:18:18 +00:00
|
|
|
; BC-NEXT: <PERMODULE {{.*}} op0=3 op1=7
|
2018-12-01 05:11:46 +00:00
|
|
|
; BC-NEXT: <PERMODULE {{.*}} op0=4 op1=0 op2=4 op3=0
|
2018-11-14 19:30:13 +00:00
|
|
|
; BC-NEXT: <ALIAS {{.*}} op0=6 op1=0 op2=3
|
2020-05-21 13:28:24 -07:00
|
|
|
; BC-NEXT: <BLOCK_COUNT op0=5/>
|
2016-04-13 17:20:07 +00:00
|
|
|
; BC-NEXT: </GLOBALVAL_SUMMARY_BLOCK
|
2017-04-17 17:51:36 +00:00
|
|
|
; BC: <STRTAB_BLOCK
|
2018-11-14 19:30:13 +00:00
|
|
|
; BC-NEXT: blob data = 'hfoobaranon.{{................................}}.0variadicllvm.va_startf{{.*}}'
|
2016-08-11 22:13:57 +00:00
|
|
|
|
2015-10-04 14:33:43 +00:00
|
|
|
|
2016-09-16 17:18:16 +00:00
|
|
|
; RUN: opt -name-anon-globals -module-summary < %s | llvm-dis | FileCheck %s
|
2015-10-04 14:33:43 +00:00
|
|
|
; Check that this round-trips correctly.
|
|
|
|
|
|
|
|
|
|
; ModuleID = '<stdin>'
|
|
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
|
|
|
|
|
|
; CHECK: define i32 @foo()
|
|
|
|
|
|
|
|
|
|
; Function Attrs: nounwind uwtable
|
|
|
|
|
define i32 @foo() #0 {
|
|
|
|
|
entry:
|
|
|
|
|
ret i32 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
; CHECK: define i32 @bar(i32 %x)
|
|
|
|
|
|
|
|
|
|
; Function Attrs: nounwind uwtable
|
|
|
|
|
define i32 @bar(i32 %x) #0 {
|
|
|
|
|
entry:
|
|
|
|
|
ret i32 %x
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-11 13:58:45 +00:00
|
|
|
; FIXME: Anonymous function and alias not currently in summary until
|
2016-09-16 17:18:16 +00:00
|
|
|
; follow on fixes to rename anonymous globals and emit alias summary
|
2016-04-11 13:58:45 +00:00
|
|
|
; entries are committed.
|
2015-10-04 14:33:43 +00:00
|
|
|
; Check an anonymous function as well, since in that case only the alias
|
|
|
|
|
; ends up in the value symbol table and having a summary.
|
|
|
|
|
@f = alias void (), void ()* @0 ; <void ()*> [#uses=0]
|
|
|
|
|
@h = external global void ()* ; <void ()*> [#uses=0]
|
|
|
|
|
|
|
|
|
|
define internal void @0() nounwind {
|
|
|
|
|
entry:
|
|
|
|
|
store void()* @0, void()** @h
|
|
|
|
|
br label %return
|
|
|
|
|
|
|
|
|
|
return: ; preds = %entry
|
|
|
|
|
ret void
|
|
|
|
|
}
|
2016-08-11 22:13:57 +00:00
|
|
|
|
|
|
|
|
define i32 @variadic(...) {
|
2018-11-14 19:30:13 +00:00
|
|
|
%ap = alloca i8*, align 8
|
|
|
|
|
%ap.0 = bitcast i8** %ap to i8*
|
|
|
|
|
call void @llvm.va_start(i8* %ap.0)
|
2016-08-11 22:13:57 +00:00
|
|
|
ret i32 42
|
|
|
|
|
}
|
2018-11-14 19:30:13 +00:00
|
|
|
|
|
|
|
|
declare void @llvm.va_start(i8*) nounwind
|