[PATCH] D70147: Repeat DevirtSCCRepeatedPass if new indirect calls are found.

Hiroshi Yamauchi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 09:38:27 PST 2019


yamauchi added a comment.

As I understand, that code around line 1323 of InlineCost.cpp would handle a simple case where a caller is passing a (constant) function pointer as a call argument and the callee simply calls it (constant propagation). But it wouldn't handle a (more complex) virtual call (vtable lookup though memory) on a stack allocated (in the caller) object passed to a callee, and would not work for this particular missed inlining case, at least, as is.

To handle such a case, it would have to add logic like the original patch (D69591 <https://reviews.llvm.org/D69591>) that detects a vtable look up pattern along with consideration for aliasing (since the vtable is in memory). But it'd be difficult to do because CallAnalyzer/InlineCost operates without actually having the code inlined (ie. interprocedural) and won't be able to reuse the facilities like llvm::FindAvailablePtrLoadStore.

It'd be conceivable to beef up CallAnalyzer to do this sort of things, but it'd be potentially non-trivial in complexity and compile-time-increasing.

The original patch D69591 <https://reviews.llvm.org/D69591> (which, I think is, fairly fine grained to this case, btw) doesn't have this issue because it applies right after the call is actually inlined and the scope of analysis becomes intraprocedural.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70147





More information about the llvm-commits mailing list