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

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 12:19:10 PDT 2021


rampitec added a comment.

In D98780#2632496 <https://reviews.llvm.org/D98780#2632496>, @madhur13490 wrote:

> 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.

Ah, right, default is false which preserves current behavior. This is OK.



================
Comment at: llvm/lib/IR/Instructions.cpp:289
     return false;
-  return !isInlineAsm();
+  return InlineAsmMayHaveIndirectCall == isInlineAsm();
 }
----------------
madhur13490 wrote:
> 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.
> 
Last case is incorrect. If it is not isInlineAsm() we should return true, just like now. It does not matter what inline asm may or may not contain then.

But my condition is also wrong. I think it is "return !isInlineAsm() || InlineAsmMayHaveIndirectCall;".


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