[llvm] r282542 - [Inliner] Fold the analysis remark into the missed remark

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 27 14:58:17 PDT 2016


Author: anemet
Date: Tue Sep 27 16:58:17 2016
New Revision: 282542

URL: http://llvm.org/viewvc/llvm-project?rev=282542&view=rev
Log:
[Inliner] Fold the analysis remark into the missed remark

There is really no reason for these to be separate.

The vectorizer started this pretty bad tradition that the text of the
missed remarks is pretty meaningless, i.e. vectorization failed.  There,
you have to query analysis to get the full picture.

I think we should just explain the reason for missing the optimization
in the missed remark when possible.  Analysis remarks should provide
information that the pass gathers regardless whether the optimization is
passing or not.

Modified:
    llvm/trunk/lib/Transforms/IPO/Inliner.cpp
    llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll
    llvm/trunk/test/Transforms/Inline/optimization-remarks.ll

Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=282542&r1=282541&r2=282542&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Tue Sep 27 16:58:17 2016
@@ -469,15 +469,13 @@ inlineCallsImpl(CallGraphSCC &SCC, CallG
         // direct call, so we keep it.
         if (Function *Callee = CS.getCalledFunction())
           if (Callee->isDeclaration()) {
-            ORE.emitOptimizationRemarkAnalysis(
-                DEBUG_TYPE, &I, Twine("definition of ") + Callee->getName() +
-                                    " is not available",
-                /*Verbose=*/true);
             using namespace ore;
             ORE.emit(DiagnosticInfoOptimizationRemarkMissed(DEBUG_TYPE,
-                                                            "NotInlined", &I)
+                                                            "NoDefinition", &I)
                      << NV("Callee", Callee) << " will not be inlined into "
-                     << NV("Caller", CS.getCaller()) << setIsVerbose());
+                     << NV("Caller", CS.getCaller())
+                     << " because its definition is unavailable"
+                     << setIsVerbose());
             continue;
           }
 

Modified: llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll?rev=282542&r1=282541&r2=282542&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll (original)
+++ llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll Tue Sep 27 16:58:17 2016
@@ -11,12 +11,12 @@
 ;   5    return foo() + bar();
 ;   6  }
 
-; CHECK:      remark: /tmp/s.c:5:10: foo will not be inlined into baz (hotness: 30)
-; CHECK-NEXT: remark: /tmp/s.c:5:18: bar will not be inlined into baz (hotness: 30)
+; CHECK:      remark: /tmp/s.c:5:10: foo will not be inlined into baz because its definition is unavailable (hotness: 30)
+; CHECK-NEXT: remark: /tmp/s.c:5:18: bar will not be inlined into baz because its definition is unavailable (hotness: 30)
 
 ; YAML:      --- !Missed
 ; YAML-NEXT: Pass:            inline
-; YAML-NEXT: Name:            NotInlined
+; YAML-NEXT: Name:            NoDefinition
 ; YAML-NEXT: DebugLoc:        { File: /tmp/s.c, Line: 5, Column: 10 }
 ; YAML-NEXT: Function:        baz
 ; YAML-NEXT: Hotness:         30
@@ -24,10 +24,11 @@
 ; YAML-NEXT:   - Callee: foo
 ; YAML-NEXT:   - String:  will not be inlined into
 ; YAML-NEXT:   - Caller: baz
+; YAML-NEXT:   - String:  because its definition is unavailable
 ; YAML-NEXT: ...
 ; YAML-NEXT: --- !Missed
 ; YAML-NEXT: Pass:            inline
-; YAML-NEXT: Name:            NotInlined
+; YAML-NEXT: Name:            NoDefinition
 ; YAML-NEXT: DebugLoc:        { File: /tmp/s.c, Line: 5, Column: 18 }
 ; YAML-NEXT: Function:        baz
 ; YAML-NEXT: Hotness:         30
@@ -35,6 +36,7 @@
 ; YAML-NEXT:   - Callee: bar
 ; YAML-NEXT:   - String:  will not be inlined into
 ; YAML-NEXT:   - Caller: baz
+; YAML-NEXT:   - String:  because its definition is unavailable
 ; YAML-NEXT: ...
 
 ; ModuleID = '/tmp/s.c'

Modified: llvm/trunk/test/Transforms/Inline/optimization-remarks.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/optimization-remarks.ll?rev=282542&r1=282541&r2=282542&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/optimization-remarks.ll (original)
+++ llvm/trunk/test/Transforms/Inline/optimization-remarks.ll Tue Sep 27 16:58:17 2016
@@ -5,10 +5,8 @@
 ; RUN:       -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
 ; RUN:       FileCheck -check-prefix=CHECK -check-prefix=HOTNESS %s
 
-; HOTNESS: definition of fox is not available
-; HOTNESS: fox will not be inlined into bar
-; NO_HOTNESS-NOT: definition of fox is not available
-; NO_HOTNESS-NOT: fox will not be inlined into bar
+; 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: foz should never be inlined (cost=never)




More information about the llvm-commits mailing list