Index: lib/Transforms/IPO/Inliner.cpp =================================================================== --- lib/Transforms/IPO/Inliner.cpp +++ lib/Transforms/IPO/Inliner.cpp @@ -348,9 +348,6 @@ if (IC.isAlways()) { DEBUG(dbgs() << " Inlining: cost=always" << ", Call: " << *CS.getInstruction() << "\n"); - ORE.emit(OptimizationRemarkAnalysis(DEBUG_TYPE, "AlwaysInline", Call) - << NV("Callee", Callee) - << " should always be inlined (cost=always)"); return true; } @@ -392,11 +389,6 @@ DEBUG(dbgs() << " Inlining: cost=" << IC.getCost() << ", thres=" << (IC.getCostDelta() + IC.getCost()) << ", Call: " << *CS.getInstruction() << '\n'); - ORE.emit(OptimizationRemarkAnalysis(DEBUG_TYPE, "CanBeInlined", Call) - << NV("Callee", Callee) << " can be inlined into " - << NV("Caller", Caller) << " with cost=" << NV("Cost", IC.getCost()) - << " (threshold=" - << NV("Threshold", IC.getCostDelta() + IC.getCost()) << ")"); return true; } @@ -562,6 +554,7 @@ ++NumCallsDeleted; } else { // Get DebugLoc to report. CS will be invalid after Inliner. + InlineCost IC = GetInlineCost(CS); DebugLoc DLoc = Instr->getDebugLoc(); BasicBlock *Block = CS.getParent(); @@ -578,10 +571,17 @@ } ++NumInlined; - // Report the inline decision. - ORE.emit(OptimizationRemark(DEBUG_TYPE, "Inlined", DLoc, Block) - << NV("Callee", Callee) << " inlined into " - << NV("Caller", Caller)); + if (IC.isAlways()) { + ORE.emit(OptimizationRemark(DEBUG_TYPE, "AlwaysInline", DLoc, Block) + << NV("Callee", Callee) << " inlined into " + << NV("Caller", Caller) << " with cost=always"); + } else { + ORE.emit(OptimizationRemark(DEBUG_TYPE, "Inlined", DLoc, Block) + << NV("Callee", Callee) << " inlined into " + << NV("Caller", Caller) << " with cost=" + << NV("Cost", IC.getCost()) << " (threshold=" + << NV("Threshold", IC.getCostDelta() + IC.getCost()) << ")"); + } // If inlining this function gave us any new call sites, throw them // onto our worklist to process. They are useful inline candidates. Index: test/LTO/Resolution/X86/diagnostic-handler-remarks-with-hotness.ll =================================================================== --- test/LTO/Resolution/X86/diagnostic-handler-remarks-with-hotness.ll +++ test/LTO/Resolution/X86/diagnostic-handler-remarks-with-hotness.ll @@ -17,6 +17,11 @@ ; YAML-NEXT: - Callee: tinkywinky ; YAML-NEXT: - String: ' inlined into ' ; YAML-NEXT: - Caller: main +; YAML-NEXT: - String: ' with cost=' +; YAML-NEXT: - Cost: '-15000' +; YAML-NEXT: - String: ' (threshold=' +; YAML-NEXT: - Threshold: '337' +; YAML-NEXT: - String: ')' ; YAML-NEXT: ... target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" Index: test/LTO/Resolution/X86/diagnostic-handler-remarks.ll =================================================================== --- test/LTO/Resolution/X86/diagnostic-handler-remarks.ll +++ test/LTO/Resolution/X86/diagnostic-handler-remarks.ll @@ -15,6 +15,11 @@ ; YAML-NEXT: - Callee: tinkywinky ; YAML-NEXT: - String: ' inlined into ' ; YAML-NEXT: - Caller: main +; YAML-NEXT: - String: ' with cost=' +; YAML-NEXT: - Cost: '-15000' +; YAML-NEXT: - String: ' (threshold=' +; YAML-NEXT: - Threshold: '337' +; YAML-NEXT: - String: ')' ; YAML-NEXT: ... target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" Index: test/LTO/X86/diagnostic-handler-remarks-with-hotness.ll =================================================================== --- test/LTO/X86/diagnostic-handler-remarks-with-hotness.ll +++ test/LTO/X86/diagnostic-handler-remarks-with-hotness.ll @@ -17,6 +17,11 @@ ; YAML-NEXT: - Callee: foo ; YAML-NEXT: - String: ' inlined into ' ; YAML-NEXT: - Caller: main +; YAML-NEXT: - String: ' with cost=' +; YAML-NEXT: - Cost: '-15000' +; YAML-NEXT: - String: ' (threshold=' +; YAML-NEXT: - Threshold: '337' +; YAML-NEXT: - String: ')' ; YAML-NEXT: ... target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" Index: test/LTO/X86/diagnostic-handler-remarks.ll =================================================================== --- test/LTO/X86/diagnostic-handler-remarks.ll +++ test/LTO/X86/diagnostic-handler-remarks.ll @@ -53,6 +53,11 @@ ; YAML-NEXT: - Callee: foo ; YAML-NEXT: - String: ' inlined into ' ; YAML-NEXT: - Caller: main +; YAML-NEXT: - String: ' with cost=' +; YAML-NEXT: - Cost: '-15000' +; YAML-NEXT: - String: ' (threshold=' +; YAML-NEXT: - Threshold: '337' +; YAML-NEXT: - String: ')' ; YAML-NEXT: ... target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" Index: test/ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll =================================================================== --- test/ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll +++ test/ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll @@ -25,6 +25,11 @@ ; YAML1-NEXT: - Callee: foo ; YAML1-NEXT: - String: ' inlined into ' ; YAML1-NEXT: - Caller: main +; YAML1-NEXT: - String: ' with cost=' +; YAML1-NEXT: - Cost: '-30' +; YAML1-NEXT: - String: ' (threshold=' +; YAML1-NEXT: - Threshold: '337' +; YAML1-NEXT: - String: ')' ; YAML1-NEXT: ... @@ -38,6 +43,11 @@ ; YAML2-NEXT: - Callee: bar ; YAML2-NEXT: - String: ' inlined into ' ; YAML2-NEXT: - Caller: foo +; YAML2-NEXT: - String: ' with cost=' +; YAML2-NEXT: - Cost: '-30' +; YAML2-NEXT: - String: ' (threshold=' +; YAML2-NEXT: - Threshold: '337' +; YAML2-NEXT: - String: ')' ; YAML2-NEXT: ... Index: test/ThinLTO/X86/diagnostic-handler-remarks.ll =================================================================== --- test/ThinLTO/X86/diagnostic-handler-remarks.ll +++ test/ThinLTO/X86/diagnostic-handler-remarks.ll @@ -22,6 +22,11 @@ ; YAML1-NEXT: - Callee: foo ; YAML1-NEXT: - String: ' inlined into ' ; YAML1-NEXT: - Caller: main +; YAML1-NEXT: - String: ' with cost=' +; YAML1-NEXT: - Cost: '-30' +; YAML1-NEXT: - String: ' (threshold=' +; YAML1-NEXT: - Threshold: '337' +; YAML1-NEXT: - String: ')' ; YAML1-NEXT: ... @@ -35,6 +40,11 @@ ; YAML2-NEXT: - Callee: bar ; YAML2-NEXT: - String: ' inlined into ' ; YAML2-NEXT: - Caller: foo +; YAML2-NEXT: - String: ' with cost=' +; YAML2-NEXT: - Cost: '-30' +; YAML2-NEXT: - String: ' (threshold=' +; YAML2-NEXT: - Threshold: '337' +; YAML2-NEXT: - String: ')' ; YAML2-NEXT: ... Index: test/Transforms/Inline/optimization-remarks-passed-yaml.ll =================================================================== --- test/Transforms/Inline/optimization-remarks-passed-yaml.ll +++ test/Transforms/Inline/optimization-remarks-passed-yaml.ll @@ -12,19 +12,18 @@ ; 4 return foo(); ; 5 } -; CHECK: remark: /tmp/s.c:4:10: foo can be inlined into bar with cost={{[0-9\-]+}} (threshold={{[0-9]+}}) (hotness: 30) -; CHECK-NEXT: remark: /tmp/s.c:4:10: foo inlined into bar (hotness: 30) +; CHECK: remark: /tmp/s.c:4:10: foo inlined into bar with cost={{[0-9\-]+}} (threshold={{[0-9]+}}) (hotness: 30) -; YAML: --- !Analysis +; YAML: --- !Passed ; YAML-NEXT: Pass: inline -; YAML-NEXT: Name: CanBeInlined +; YAML-NEXT: Name: Inlined ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 4, Column: 10 } ; YAML-NEXT: Function: bar ; YAML-NEXT: Hotness: 30 ; YAML-NEXT: Args: ; YAML-NEXT: - Callee: foo ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 1, Column: 0 } -; YAML-NEXT: - String: ' can be inlined into ' +; YAML-NEXT: - String: ' inlined into ' ; YAML-NEXT: - Caller: bar ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 3, Column: 0 } ; YAML-NEXT: - String: ' with cost=' @@ -33,19 +32,6 @@ ; YAML-NEXT: - Threshold: '{{[0-9]+}}' ; YAML-NEXT: - String: ')' ; YAML-NEXT: ... -; YAML-NEXT: --- !Passed -; YAML-NEXT: Pass: inline -; YAML-NEXT: Name: Inlined -; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 4, Column: 10 } -; YAML-NEXT: Function: bar -; YAML-NEXT: Hotness: 30 -; YAML-NEXT: Args: -; YAML-NEXT: - Callee: foo -; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 1, Column: 0 } -; YAML-NEXT: - String: ' inlined into ' -; YAML-NEXT: - Caller: bar -; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 3, Column: 0 } -; YAML-NEXT: ... ; ModuleID = '/tmp/s.c' source_filename = "/tmp/s.c" Index: test/Transforms/Inline/optimization-remarks-with-hotness.ll =================================================================== --- test/Transforms/Inline/optimization-remarks-with-hotness.ll +++ test/Transforms/Inline/optimization-remarks-with-hotness.ll @@ -2,8 +2,7 @@ ; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 \ ; RUN: | FileCheck %s -; CHECK: foo should always be inlined (cost=always) (hotness: 30) -; CHECK: foo inlined into bar (hotness: 30) +; CHECK: foo inlined into bar with cost=always (hotness: 30) ; CHECK: foz not inlined into bar because it should never be inlined (cost=never) (hotness: 30) ; Function Attrs: alwaysinline nounwind uwtable Index: test/Transforms/Inline/optimization-remarks.ll =================================================================== --- test/Transforms/Inline/optimization-remarks.ll +++ test/Transforms/Inline/optimization-remarks.ll @@ -7,8 +7,7 @@ ; HOTNESS: fox will not be inlined into bar because its definition is unavailable ; NO_HOTNESS-NOT: fox will not be inlined into bar because its definition is unavailable -; CHECK: foo should always be inlined (cost=always) -; CHECK: foo inlined into bar +; CHECK: foo inlined into bar with cost=always ; CHECK: foz not inlined into bar because it should never be inlined (cost=never) ; Function Attrs: alwaysinline nounwind uwtable