[PATCH] D150396: [InlineCost] Check for conflicting target attributes early

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 11 13:41:41 PDT 2023


kazu added inline comments.


================
Comment at: llvm/lib/Analysis/InlineCost.cpp:2917
+      !CalleeTTI.areInlineCompatible(Caller, Callee)) {
+    fprintf(stderr, "InlineCost.cpp:%d\n", __LINE__);
+    return InlineResult::failure("conflicting target attributes");
----------------
tejohnson wrote:
> Probably this should be a missed optimization remark?
Oops.  I didn't meant to publish the `fprintf`, but yes, I'll turn it into a missed optimization remark.


================
Comment at: llvm/lib/Analysis/InlineCost.cpp:2935
   // always-inline attribute).
-  Function *Caller = Call.getCaller();
-  if (!functionsHaveCompatibleAttributes(Caller, Callee, CalleeTTI, GetTLI))
+  if (!functionsHaveCompatibleAttributes(Caller, Callee, GetTLI))
     return InlineResult::failure("conflicting attributes");
----------------
tejohnson wrote:
> Can we move this above the always inline handling and put the new checking in here?
Could you elaborate this comment a little bit?  I am not sure what you mean by "put the new checking in here".

This patch essentially peels the `CalleeTTI.areInlineCompatible` check off of `functionsHaveCompatibleAttributes`.  If we are moving the rest of `functionsHaveCompatibleAttributes` above the always inline handling, then we might just call the original unmodified `functionsHaveCompatibleAttributes` above the always inline handling.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150396/new/

https://reviews.llvm.org/D150396



More information about the llvm-commits mailing list