Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ThinLTO] Disable importing and other cross-module optis at -O0
Summary: There is no point to importing at -O0, since we won't inline. We should also disable other cross-module optimizations. (Plan to backport this fix to the 3.9 branch to fix PR30774) Reviewers: pcc Subscribers: johanengelen, mehdi_amini Differential Revision: https://reviews.llvm.org/D25918 llvm-svn: 285648
- Loading branch information
1 parent
67eda2a
commit 002af9b
Showing
6 changed files
with
115 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" | ||
target triple = "x86_64-apple-macosx10.11.0" | ||
|
||
|
||
define i32 @main() #0 { | ||
entry: | ||
call void (...) @foo() | ||
ret i32 0 | ||
} | ||
|
||
declare void @foo(...) #1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
; Do setup work for all below tests: generate bitcode and combined index | ||
; RUN: opt -module-summary %s -o %t1.bc | ||
; RUN: opt -module-summary %p/Inputs/funcimport2.ll -o %t2.bc | ||
|
||
; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \ | ||
; RUN: -r=%t1.bc,_foo,plx \ | ||
; RUN: -r=%t2.bc,_main,plx \ | ||
; RUN: -r=%t2.bc,_foo,l | ||
; RUN: llvm-dis %t.o.1.3.import.bc -o - | FileCheck %s | ||
; CHECK: define available_externally void @foo() | ||
|
||
; We shouldn't do any importing at -O0 | ||
; rm -f %t.o.1.3.import.bc | ||
; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \ | ||
; RUN: -O0 \ | ||
; RUN: -r=%t1.bc,_foo,plx \ | ||
; RUN: -r=%t2.bc,_main,plx \ | ||
; RUN: -r=%t2.bc,_foo,l | ||
; RUN: llvm-dis %t.o.1.3.import.bc -o - | FileCheck %s --check-prefix=CHECKO0 | ||
; CHECKO0: declare void @foo(...) | ||
|
||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" | ||
target triple = "x86_64-apple-macosx10.11.0" | ||
|
||
define void @foo() #0 { | ||
entry: | ||
ret void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | ||
target triple = "x86_64-unknown-linux-gnu" | ||
|
||
define i32 @main() #0 { | ||
entry: | ||
call void (...) @foo() | ||
ret i32 0 | ||
} | ||
|
||
declare void @foo(...) #1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
; Do setup work for all below tests: generate bitcode and combined index | ||
; RUN: opt -module-summary %s -o %t1.bc | ||
; RUN: opt -module-summary %p/Inputs/thinlto_funcimport.ll -o %t2.bc | ||
|
||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \ | ||
; RUN: --plugin-opt=save-temps \ | ||
; RUN: --plugin-opt=thinlto \ | ||
; RUN: -shared %t1.bc %t2.bc -o %t | ||
; RUN: llvm-dis %t2.bc.3.import.bc -o - | FileCheck %s | ||
; CHECK: define available_externally void @foo() | ||
|
||
; We shouldn't do any importing at -O0 | ||
; rm -f %t2.bc.3.import.bc | ||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \ | ||
; RUN: --plugin-opt=save-temps \ | ||
; RUN: --plugin-opt=thinlto \ | ||
; RUN: --plugin-opt=O0 \ | ||
; RUN: -shared %t1.bc %t2.bc -o %t | ||
; RUN: llvm-dis %t2.bc.3.import.bc -o - | FileCheck %s --check-prefix=CHECKO0 | ||
; CHECKO0: declare void @foo(...) | ||
|
||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | ||
target triple = "x86_64-unknown-linux-gnu" | ||
|
||
define void @foo() #0 { | ||
entry: | ||
ret void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters