[PATCH] D86260: [CodeGen] Postprocess PHI nodes for callbr

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 15:57:56 PDT 2020


jyknight added a comment.

In D86260#2229406 <https://reviews.llvm.org/D86260#2229406>, @void wrote:

> In D86260#2229387 <https://reviews.llvm.org/D86260#2229387>, @jyknight wrote:
>
>> The commit message is confusing for this -- this isn't a correctness fix, but a minor optimization, right?
>
> I'm not convinced it's just an optimization, but I could be swayed. It seems to me that the value coming into the PHI shouldn't rely upon the semantics of the asm block. So for instance would this be incorrect?

Inline assembly must declare what registers it clobbers, and the compiler can safely assume other registers are preserved across it.

>   bb1:
>     %eax = MOV 0
>     INLINEASM_BR "mov 37, %eax"
>     JMP return
>   
>   return:
>     PHI bb1, 0 ...

So, in this example the input inline-asm is invalid, because it failed to declare that it clobbered eax.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86260



More information about the llvm-commits mailing list