Skip to content

Commit

Permalink
[LTO] Add an early run of functionattrs
Browse files Browse the repository at this point in the history
Because we internalize early, we can potentially mark a bunch of functions as norecurse. Do this before globalopt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253451 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
James Molloy committed Nov 18, 2015
1 parent 51f7c58 commit 683e0e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/Transforms/IPO/PassManagerBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ void PassManagerBuilder::addLTOOptimizationPasses(legacy::PassManagerBase &PM) {
PM.add(createIPSCCPPass());

// Now that we internalized some globals, see if we can hack on them!
PM.add(createFunctionAttrsPass()); // Add norecurse if possible.
PM.add(createGlobalOptimizerPass());

// Linking modules together can lead to duplicated global constants, only
Expand Down
5 changes: 4 additions & 1 deletion test/LTO/X86/diagnostic-handler-remarks.ll
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@

target triple = "x86_64-apple-darwin"

declare i32 @bar()

define i32 @foo() {
ret i32 7
%a = call i32 @bar()
ret i32 %a
}

define i32 @main() {
Expand Down

0 comments on commit 683e0e5

Please sign in to comment.