[PATCH] D149889: [TTI] Use users of GEP to guess access type in getGEPCost

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 05:21:36 PDT 2023


luke added a comment.

In D149889#4319936 <https://reviews.llvm.org/D149889#4319936>, @nikic wrote:

> You should be able to avoid the LICM changes by adjusting the code at https://github.com/llvm/llvm-project/blob/bfb7c99f3aeab09236adf1f684f7144f384c6dd7/llvm/lib/Transforms/Scalar/LICM.cpp#L1346-L1361 to only pass the users in the loop (and drop the separate user iteration that code does).

Thanks, just tried it and it seems to work.

> Something I'm concerned about here is that your default implementation is going to scan all users of the instruction, which means that the cost query is now O(n) instead of O(1). This is probably not acceptable for compile-time reasons. Can we get away with only inspecting a single user in that case and assume it is representative?

Yeah I think that should still work for our SLP use case, sounds like a good compromise. Will try that and report back.

> This change seems to cause some pretty large code size changes on x86 at least (https://llvm-compile-time-tracker.com/compare.php?from=b77265711b390a6905e8901694d75f4b3812c71a&to=113f1989fa7e469407942249b4086e3a28da2bf4&stat=size-text), so it seems like a pretty high impact change. I can't say whether those changes are good or bad though :)

Indeed, from a quick look it looks like it might be affecting the inliner?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149889



More information about the llvm-commits mailing list