[llvm-dev] trunc nsw/nuw?
Alexandre Isoard via llvm-dev
llvm-dev at lists.llvm.org
Mon Jul 3 12:38:45 PDT 2017
>From , trunc does not seems to have a nsw/nuw attribute.
Is it possible to have that? Or do we have that and it is not up-to-date?
The definition would be:
If the nuw keyword is present, the result value of the trunc is a poison
value if the truncated high order bits are non-zero. If the nsw keyword is
present, the result value of the trunc is a poison value if the truncated
high order bits are not all equal to the non-truncated bit of the highest
This allow to cancel out:
- sext with trunc nsw
- zext with trunc nuw
And probably to commute with add/sub/mul/lshr/ashr/shl/urem/udiv/udiv (with
the correct flags).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev