[PATCH] D36054: Emit only A Single Opt Remark When Inlining

Adam Nemet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 15:50:58 PDT 2017

anemet added inline comments.

Comment at: lib/Transforms/IPO/Inliner.cpp:387-389
+    // IC does not bool() to false, so get an InlineCost that will.
+    // This will not be inspected to make an error message.
+    return InlineCost::getNever();
I am fine with this.  Alternatively we could change the return type to Optional<InlineCost> and return None here and check (!IC || !*IC) in the caller but that seems like an overkill.

Comment at: lib/Transforms/IPO/Inliner.cpp:577-581
+        if (IC.isAlways()) {
+          ORE.emit(OptimizationRemark(DEBUG_TYPE, "AlwaysInline", DLoc, Block)
+                   << NV("Callee", Callee) << " inlined into "
+                   << NV("Caller", Caller) << " with cost=always");
+        } else {
No {} around a single statement.

Comment at: lib/Transforms/IPO/Inliner.cpp:879-882
+      InlineCost IC = shouldInline(CS, GetInlineCost, ORE);
       // Check whether we want to inline this callsite.
-      if (!shouldInline(CS, GetInlineCost, ORE))
+      if (!IC)
Isn't this the path via the new PM?  Don't you need to emit the remarks for the successful inlining here as well?

Should probably add a test for this if I am right ;).


More information about the llvm-commits mailing list