[llvm] [IR] Add zext nneg flag (PR #67982)

LĂ©onard Oest O'Leary via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 2 15:34:49 PDT 2023


leo-ard wrote:

Thanks for doing this PR, I am the author of #67594 and this is very useful. I just had some ideas from your though/comments and wanted to tag along

> Wonder whether the flag should also be supported on sext.

I don't think this would be useful, even for consistency, as `zext nneg` and `sext nneg` are exactly the same instruction (pad zeros at the front of the value, and we know that the argument is positive). I think a better question is : should we add the `nneg` attribute to `zext` or `sext` ? or even : Is there an underlying instruction, such as `ext` that could represent what we want ? We could have `ext sign ...` `ext zero ...` and `ext nneg ...`. All of the tree scenarios (signed, zero and zero but we know its positive) seems to be mutually exclusive

https://github.com/llvm/llvm-project/pull/67982


More information about the llvm-commits mailing list