[LLVMdev] nsw/nuw for trunc
Chris Lattner
clattner at apple.com
Thu Aug 11 11:03:55 PDT 2011
On Aug 11, 2011, at 5:17 AM, Florian Merz wrote:
> Hi everyone,
>
> we'd like to be able to check for loss of information in trunc operations in
> our LLVM-based bounded model checker [1]. For this it is important if the
> trunc was on a signed or unsigned integer, so we need nsw and nuw flags for
> this. Would you accept a patch that adds these flags to LLVM (and possibly
> clang)?
In contrast to the other folks, I think that this makes perfect sense, and NSW/NUW are the right thing to use.
It would be valid for instcombine to delete "sext(trunc_nsw x)" when the source and dest types are the same, similarly "zext(trunc_nuw x)".
The semantics are very similar to the left shift operator and many others.
-Chris
More information about the llvm-dev
mailing list