[PATCH] D129954: [CodeGen][inlineasm] assume the flag output of inline asm is boolean value

Yuanfang Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 17 12:57:11 PDT 2022


ychen added a comment.

In D129954#3658139 <https://reviews.llvm.org/D129954#3658139>, @nikic wrote:

> Hm, might it be better to teach LLVM about this (in some ConstantRange/KnownBits logic)? This doesn't really seem like something the frontend should know about and encode, as that means each frontend has to add this annotation by itself.

Agreed that teaching LLVM about his saves other frontends from doing the same thing. The information is inline asm semantic defined by GCC extension though, I think putting it in the frontend is a valid choice and makes the implementation easy.

I looked into where to put this in LLVM. It seems nontrivial: existing ConstantRanges are computed from binary-op/comparsion etc. Inferring range from an inline asm call is something passes (LazyValueInfo) need to learn, with some kinds of def-use chain walking. That said, I'm definitely new to ConstantRange analysis, it may well be that this is not that hard to implement. Could you please give some guidance?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129954



More information about the cfe-commits mailing list