[PATCH] D98884: [IR] Add opt-in parameter to hasAddressTaken() to ignore bitcasts callee in callbase instruction

Madhur Amilkanthwar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 19 03:48:44 PDT 2021


madhur13490 added a comment.

In D98884#2635456 <https://reviews.llvm.org/D98884#2635456>, @lebedev.ri wrote:

> What problem are you trying to solve?

For AMGGPU target, we want to add a bunch of attributes to those functions which are indirectly called. To call a function indirectly, the programmer first needs to capture its address in a function pointer and use the function pointer in a call instruction. Many times the address is taken but not really stored anywhere and thus not used meaningfully or in any way which can be de-referenced.  One such example is usage of bitcasts in call instruction as shown in the test case. hasAddressTaken() API is useful for the purpose but we want ignore such “false” address taken cases whose the address is not really used. This patch adds an optional flag to ignore those cases. As it stands today, hasAddressTaken() returns "true" for the test case, which is correct but skipping the test scenario is useful for us.

I hope this clarifies.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98884



More information about the llvm-commits mailing list