[PATCH] D98780: [IR] Add opt-in flag to isIndirectCall() to consider inlineasm

Madhur Amilkanthwar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 12:08:47 PDT 2021


madhur13490 added a comment.

In D98780#2632418 <https://reviews.llvm.org/D98780#2632418>, @rampitec wrote:

> It shall probably be target dependent.

Well, it is useful for core analyses too. Targets can choose to pass the flag as their need.



================
Comment at: llvm/lib/IR/Instructions.cpp:289
     return false;
-  return !isInlineAsm();
+  return InlineAsmMayHaveIndirectCall == isInlineAsm();
 }
----------------
rampitec wrote:
> It will give wrong answer for non-asm. "return !isInlineAsm() || !InlineAsmMayHaveIndirectCall;"
I don't think why it would return wrong answer. Here is the truth table of the operation:

1. InlineAsmMayHaveIndirectCall = false, isInlineAsm() = false --> return "true" (as expected)
2. InlineAsmMayHaveIndirectCall = false, isInlineAsm() = true --> return "false" (as expected)
3. InlineAsmMayHaveIndirectCall = true, isInlineAsm() = true --> return "true" (as expected)
4. InlineAsmMayHaveIndirectCall = true, isInlineAsm() = false --> return "false" (as expected)

1 & 2 above are according to today's behavior. 3 & 4 are the new ones. Which of the above is incorrect?

FWIW, "==" operator enacts XNOR for bools.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98780



More information about the llvm-commits mailing list