mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
3457994310
While updating clang tests for having clang set dso_local I noticed that: - There are *a lot* of tests to update. - Many of the updates are redundant. They are redundant because a GV is "obviously dso_local". This patch starts formalizing that a bit by requiring that internal and private GVs be dso_local too. Since they all are, we don't have to print dso_local to the textual representation, making it a bit more compact and easier to read. llvm-svn: 322317
66 lines
1.8 KiB
LLVM
66 lines
1.8 KiB
LLVM
; RUN: llvm-split -preserve-locals -o %t %s
|
|
; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK0 %s
|
|
; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK1 %s
|
|
|
|
; The local_var and local_func must not be separated.
|
|
; CHECK0: @local_var
|
|
; CHECK0: define internal fastcc void @local_func
|
|
; The main and a must not be separated.
|
|
; The main and local_func must not be together.
|
|
; CHECK1: @a
|
|
; CHECK1: define i32 @main
|
|
; CHECK1: declare dso_local fastcc void @local_func
|
|
|
|
@a = internal global i32 0, align 4
|
|
@global_storage = common global i32 0, align 4
|
|
@local_var = internal global i32 0, align 4
|
|
|
|
; Function Attrs: nounwind
|
|
define i32 @main(i32 %x) {
|
|
entry:
|
|
%call = call fastcc i32 @foo(i32 %x, i32* nonnull @a)
|
|
%call1 = call fastcc i32 @baz(i32 %x)
|
|
%add = add nsw i32 %call, %call1
|
|
ret i32 %add
|
|
}
|
|
|
|
; Function Attrs: nounwind
|
|
define fastcc i32 @bar(i32 %b) {
|
|
entry:
|
|
%call = call fastcc i32 @baz(i32 %b)
|
|
ret i32 %call
|
|
}
|
|
|
|
; Function Attrs: nounwind
|
|
define fastcc i32 @baz(i32 %x) {
|
|
entry:
|
|
store i32 %x, i32* @global_storage, align 4
|
|
%shl = shl i32 %x, %x
|
|
ret i32 %shl
|
|
}
|
|
|
|
; Function Attrs: noinline nounwind
|
|
define fastcc i32 @foo(i32 %a, i32* nocapture %b) {
|
|
entry:
|
|
call fastcc void @local_func()
|
|
%call = call fastcc i32 @bar(i32 %a)
|
|
%0 = load i32, i32* @global_storage, align 4
|
|
%call1 = call fastcc i32 @baz(i32 %0)
|
|
%add = add nsw i32 %call, %call1
|
|
store i32 %add, i32* %b, align 4
|
|
%call.i = call fastcc i32 @baz(i32 %add) #2
|
|
%add.i = add nsw i32 %call.i, 2
|
|
%1 = load volatile i32, i32* @local_var, align 4
|
|
%add3 = add nsw i32 %add.i, %1
|
|
ret i32 %add3
|
|
}
|
|
|
|
; Function Attrs: noinline nounwind
|
|
define internal fastcc void @local_func() section ".text" {
|
|
entry:
|
|
%0 = load i32, i32* @global_storage, align 4
|
|
%call = call fastcc i32 @foo(i32 %0, i32* null)
|
|
store volatile i32 %call, i32* @local_var, align 4
|
|
ret void
|
|
}
|