[LTO] Add an early run of functionattrs
authorJames Molloy <james.molloy@arm.com>
Wed, 18 Nov 2015 11:24:42 +0000 (11:24 +0000)
committerJames Molloy <james.molloy@arm.com>
Wed, 18 Nov 2015 11:24:42 +0000 (11:24 +0000)
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

lib/Transforms/IPO/PassManagerBuilder.cpp
test/LTO/X86/diagnostic-handler-remarks.ll

index 6e0d23961cabdc79f528e798e69f82701c0fc17e..ec6f21e8c64fd416f23670120dfb8f502cf8b967 100644 (file)
@@ -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(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
   PM.add(createGlobalOptimizerPass());
 
   // Linking modules together can lead to duplicated global constants, only
index 690a9014a7e12d48f88f880439165dc8805fde04..a368a677b2fe543c1f0d1049c659d2c4ed325076 100644 (file)
 
 target triple = "x86_64-apple-darwin"
 
 
 target triple = "x86_64-apple-darwin"
 
+declare i32 @bar()
+
 define i32 @foo() {
 define i32 @foo() {
-  ret i32 7
+  %a = call i32 @bar()
+  ret i32 %a
 }
 
 define i32 @main() {
 }
 
 define i32 @main() {