[llvm] r329116 - [MachineOutliner][NFC] Make outlined functions have internal linkage
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 3 14:36:00 PDT 2018
Author: paquette
Date: Tue Apr 3 14:36:00 2018
New Revision: 329116
URL: http://llvm.org/viewvc/llvm-project?rev=329116&view=rev
Log:
[MachineOutliner][NFC] Make outlined functions have internal linkage
The linkage type on outlined functions was private before. This meant that if
you set a breakpoint in an outlined function, the debugger wouldn't be able to
give a sane name to the outlined function.
This commit changes the linkage type to internal and updates any tests that
relied on the prefixes on the names of outlined functions.
Modified:
llvm/trunk/lib/CodeGen/MachineOutliner.cpp
llvm/trunk/test/CodeGen/AArch64/machine-outliner.ll
llvm/trunk/test/CodeGen/X86/machine-outliner-debuginfo.ll
llvm/trunk/test/CodeGen/X86/machine-outliner-tailcalls.ll
llvm/trunk/test/CodeGen/X86/machine-outliner.ll
Modified: llvm/trunk/lib/CodeGen/MachineOutliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineOutliner.cpp?rev=329116&r1=329115&r2=329116&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineOutliner.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineOutliner.cpp Tue Apr 3 14:36:00 2018
@@ -1239,7 +1239,7 @@ MachineOutliner::createOutlinedFunction(
// NOTE: If this is linkonceodr, then we can take advantage of linker deduping
// which gives us better results when we outline from linkonceodr functions.
- F->setLinkage(GlobalValue::PrivateLinkage);
+ F->setLinkage(GlobalValue::InternalLinkage);
F->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
// Save F so that we can add debug info later if we need to.
Modified: llvm/trunk/test/CodeGen/AArch64/machine-outliner.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/machine-outliner.ll?rev=329116&r1=329115&r2=329116&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/machine-outliner.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/machine-outliner.ll Tue Apr 3 14:36:00 2018
@@ -1,16 +1,11 @@
-; RUN: llc -enable-machine-outliner -mtriple=aarch64-apple-darwin < %s | FileCheck %s -check-prefix=NoODR
+; RUN: llc -enable-machine-outliner -mtriple=aarch64-apple-darwin < %s | FileCheck %s
; RUN: llc -enable-machine-outliner -enable-linkonceodr-outlining -mtriple=aarch64-apple-darwin < %s | FileCheck %s -check-prefix=ODR
define linkonce_odr void @fish() #0 {
; CHECK-LABEL: _fish:
- ; NoODR: orr w8, wzr, #0x1
- ; NoODR-NEXT: stp w8, wzr, [sp, #8]
- ; NoODR-NEXT: orr w8, wzr, #0x2
- ; NoODR-NEXT: str w8, [sp, #4]
- ; NoODR-NEXT: orr w8, wzr, #0x3
- ; NoODR-NEXT: str w8, [sp], #16
- ; NoODR-NEXT: ret
- ; ODR: b l_OUTLINED_FUNCTION_0
+ ; CHECK-NOT: OUTLINED
+ ; ODR: [[OUTLINED:OUTLINED_FUNCTION_[0-9]+]]
+ ; ODR-NOT: ret
%1 = alloca i32, align 4
%2 = alloca i32, align 4
%3 = alloca i32, align 4
@@ -24,8 +19,10 @@ define linkonce_odr void @fish() #0 {
define void @cat() #0 {
; CHECK-LABEL: _cat:
- ; CHECK: b l_OUTLINED_FUNCTION_0
+ ; CHECK: [[OUTLINED:OUTLINED_FUNCTION_[0-9]+]]
+ ; ODR: [[OUTLINED]]
; CHECK-NOT: ret
+ ; ODR-NOT: ret
%1 = alloca i32, align 4
%2 = alloca i32, align 4
%3 = alloca i32, align 4
@@ -39,8 +36,10 @@ define void @cat() #0 {
define void @dog() #0 {
; CHECK-LABEL: _dog:
- ; CHECK: b l_OUTLINED_FUNCTION_0
+ ; CHECK: [[OUTLINED]]
+ ; ODR: [[OUTLINED]]
; CHECK-NOT: ret
+ ; ODR-NOT: ret
%1 = alloca i32, align 4
%2 = alloca i32, align 4
%3 = alloca i32, align 4
@@ -52,8 +51,9 @@ define void @dog() #0 {
ret void
}
-; CHECK-LABEL: l_OUTLINED_FUNCTION_0:
-; CHECK: orr w8, wzr, #0x1
+; ODR: [[OUTLINED]]:
+; CHECK: [[OUTLINED]]:
+; CHECK-DAG: orr w8, wzr, #0x1
; CHECK-NEXT: stp w8, wzr, [sp, #8]
; CHECK-NEXT: orr w8, wzr, #0x2
; CHECK-NEXT: str w8, [sp, #4]
@@ -61,4 +61,4 @@ define void @dog() #0 {
; CHECK-NEXT: str w8, [sp], #16
; CHECK-NEXT: ret
-attributes #0 = { noredzone nounwind ssp uwtable "no-frame-pointer-elim"="false" "target-cpu"="cyclone" }
+attributes #0 = { noredzone "target-cpu"="cyclone" }
Modified: llvm/trunk/test/CodeGen/X86/machine-outliner-debuginfo.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/machine-outliner-debuginfo.ll?rev=329116&r1=329115&r2=329116&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/machine-outliner-debuginfo.ll (original)
+++ llvm/trunk/test/CodeGen/X86/machine-outliner-debuginfo.ll Tue Apr 3 14:36:00 2018
@@ -10,7 +10,8 @@ define i32 @main() #0 !dbg !11 {
%4 = alloca i32, align 4
%5 = alloca i32, align 4
; There is a debug value in the middle of this section, make sure debug values are ignored.
- ; CHECK: callq l_OUTLINED_FUNCTION_0
+ ; CHECK: callq
+ ; CHECK-SAME: OUTLINED_FUNCTION_0
store i32 1, i32* %2, align 4
store i32 2, i32* %3, align 4
store i32 3, i32* %4, align 4
@@ -20,7 +21,8 @@ define i32 @main() #0 !dbg !11 {
call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
; This is the same sequence of instructions without a debug value. It should be outlined
; in the same way.
- ; CHECK: callq l_OUTLINED_FUNCTION_0
+ ; CHECK: callq
+ ; CHECK-SAME: OUTLINED_FUNCTION_0
store i32 1, i32* %2, align 4
store i32 2, i32* %3, align 4
store i32 3, i32* %4, align 4
@@ -29,7 +31,7 @@ define i32 @main() #0 !dbg !11 {
ret i32 0, !dbg !25
}
-; CHECK-LABEL: l_OUTLINED_FUNCTION_0:
+; CHECK: OUTLINED_FUNCTION_0:
; CHECK-NOT: .loc {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} {{^(is_stmt)}}
; CHECK-NOT: ##DEBUG_VALUE: main:{{[a-z]}} <- {{[0-9]+}}
; CHECK: movl $1, -{{[0-9]+}}(%rbp)
Modified: llvm/trunk/test/CodeGen/X86/machine-outliner-tailcalls.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/machine-outliner-tailcalls.ll?rev=329116&r1=329115&r2=329116&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/machine-outliner-tailcalls.ll (original)
+++ llvm/trunk/test/CodeGen/X86/machine-outliner-tailcalls.ll Tue Apr 3 14:36:00 2018
@@ -4,7 +4,8 @@
define i32 @foo0(i32) local_unnamed_addr #0 {
; CHECK-LABEL: _foo0:
-; CHECK: jmp l_OUTLINED_FUNCTION_0
+; CHECK: jmp
+; CHECK-SAME: OUTLINED_FUNCTION_0
; CHECK-NEXT: .cfi_endproc
store i32 0, i32* @x, align 4, !tbaa !2
%2 = tail call i32 @ext(i32 1) #2
@@ -15,7 +16,8 @@ declare i32 @ext(i32) local_unnamed_addr
define i32 @foo1(i32) local_unnamed_addr #0 {
; CHECK-LABEL: _foo1:
-; CHECK: jmp l_OUTLINED_FUNCTION_0
+; CHECK: jmp
+; CHECK-SAME: OUTLINED_FUNCTION_0
; CHECK-NEXT: .cfi_endproc
store i32 0, i32* @x, align 4, !tbaa !2
%2 = tail call i32 @ext(i32 1) #2
@@ -29,7 +31,7 @@ attributes #0 = { noredzone nounwind ssp
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}
-; CHECK-LABEL: l_OUTLINED_FUNCTION_0:
-; CHECK: movl $0, (%rax)
+; CHECK: OUTLINED_FUNCTION_0:
+; CHECK-DAG: movl $0, (%rax)
; CHECK-NEXT: movl $1, %edi
; CHECK-NEXT: jmp _ext
Modified: llvm/trunk/test/CodeGen/X86/machine-outliner.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/machine-outliner.ll?rev=329116&r1=329115&r2=329116&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/machine-outliner.ll (original)
+++ llvm/trunk/test/CodeGen/X86/machine-outliner.ll Tue Apr 3 14:36:00 2018
@@ -15,7 +15,8 @@ define i32 @check_boundaries() #0 {
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
- ; CHECK: callq [[OFUNC1:l_OUTLINED_FUNCTION_[0-9]+]]
+ ; CHECK: callq
+ ; CHECK-SAME: [[OFUNC1:OUTLINED_FUNCTION_[0-9]+]]
; CHECK: cmpl $0, -{{[0-9]+}}(%rbp)
store i32 1, i32* %2, align 4
store i32 2, i32* %3, align 4
@@ -30,7 +31,8 @@ define i32 @check_boundaries() #0 {
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
- ; CHECK: callq [[OFUNC1]]
+ ; CHECK: callq
+ ; CHECK-SAME: [[OFUNC1]]
store i32 1, i32* %2, align 4
store i32 2, i32* %3, align 4
store i32 3, i32* %4, align 4
@@ -45,13 +47,13 @@ define i32 @check_boundaries() #0 {
define i32 @empty_1() #0 {
; CHECK-LABEL: _empty_1:
- ; CHECK-NOT: callq l_OUTLINED_FUNCTION_{{[0-9]+}}
+ ; CHECK-NOT: OUTLINED_FUNCTION
ret i32 1
}
define i32 @empty_2() #0 {
; CHECK-LABEL: _empty_2
- ; CHECK-NOT: callq l_OUTLINED_FUNCTION_{{[0-9]+}}
+ ; CHECK-NOT: OUTLINED_FUNCTION
ret i32 1
}
@@ -59,7 +61,7 @@ define i32 @no_empty_outlining() #0 {
; CHECK-LABEL: _no_empty_outlining:
%1 = alloca i32, align 4
store i32 0, i32* %1, align 4
- ; CHECK-NOT: callq l_OUTLINED_FUNCTION_{{[0-9]+}}
+ ; CHECK-NOT: OUTLINED_FUNCTION
%2 = call i32 @empty_1() #1
%3 = call i32 @empty_2() #1
%4 = call i32 @empty_1() #1
@@ -79,14 +81,16 @@ define i32 @main() #0 {
store i32 0, i32* %1, align 4
store i32 0, i32* @x, align 4
- ; CHECK: callq [[OFUNC2:l_OUTLINED_FUNCTION_[0-9]+]]
+ ; CHECK: callq
+ ; CHECK-SAME: [[OFUNC2:OUTLINED_FUNCTION_[0-9]+]]
store i32 1, i32* %2, align 4
store i32 2, i32* %3, align 4
store i32 3, i32* %4, align 4
store i32 4, i32* %5, align 4
store i32 1, i32* @x, align 4
call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
- ; CHECK: callq [[OFUNC2]]
+ ; CHECK: callq
+ ; CHECK-SAME: [[OFUNC2]]
store i32 1, i32* %2, align 4
store i32 2, i32* %3, align 4
store i32 3, i32* %4, align 4
@@ -96,15 +100,15 @@ define i32 @main() #0 {
attributes #0 = { noredzone nounwind ssp uwtable "no-frame-pointer-elim"="true" }
-; CHECK-LABEL: l_OUTLINED_FUNCTION_{{[0-9]+}}:
-; CHECK: movl $1, -{{[0-9]+}}(%rbp)
+; CHECK: OUTLINED_FUNCTION_{{[0-9]+}}:
+; CHECK-DAG: movl $1, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl $2, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl $3, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl $4, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: retq
-; CHECK-LABEL: l_OUTLINED_FUNCTION_{{[0-9]+}}:
-; CHECK: movl $1, -{{[0-9]+}}(%rbp)
+; CHECK: OUTLINED_FUNCTION_{{[0-9]+}}:
+; CHECK-DAG: movl $1, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl $2, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl $3, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl $4, -{{[0-9]+}}(%rbp)
More information about the llvm-commits
mailing list