On Aug 11, 2011, at 11:03 AM, Chris Lattner 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. John.
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
On Aug 11, 2011, at 12:47 , Chris Lattner wrote:> > 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.I can think of a use for it in my project if it were in the LLVM IR. It would be nice if LLVM optimizers could understand this feature. I would encourage you to consider accepting patches that implemented this improvement. — j h woodyatt <jhw at conjury.org> http://jhw.dreamwidth.org/