[LLVMdev] nsw/nuw for trunc
Chris Lattner
clattner at apple.com
Thu Aug 11 12:47:35 PDT 2011
On Aug 11, 2011, at 11:32 AM, John McCall wrote:
>> 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.
>
> I agree that there's some abstract consistency in providing nsw/nuw
> for trunc, even if no current frontends would ever emit it, but I do not
> get the impression that Florian actually wants the optimizer making
> random transformations based on the assumed undefined behavior
> of these truncations.
For clarity, I'm saying that it would make sense for LLVM IR to support this concept (instcombine could infer it for example), but I don't think it makes sense for clang to generate it.
-Chris
More information about the llvm-dev
mailing list