Lin-Ya Yu via llvm-dev
2018-Aug-14 11:28 UTC
[llvm-dev] nuw, nsw flags for SCEVAdd and SCEVMul
Hi, I found out that we do not have nuw and nsw flags for some situations. I ran test cases with range metadata: !2 = !{i16 0, i16 128} And I get nuw, nsw flags for %A = add i16 %x, 2 --> (2 + %x)<nuw><nsw> U: [2,130) S: [2,130) But for below cases, there are no nuw or nsw flags shown. %A = add i16 %x, %x --> (2 * %x) U: [0,255) S: [0,255) %A = mul i16 %x, 2 --> (2 * %x) U: [0,255) S: [0,255) %A = mul i16 %x, %x --> (%x * %x) U: [0,16130) S: [0,16130)>From the range we calculated here. Can't we have the flags?And for instructions with nuw, I still did not get those flags. %A = mul nuw i16 %x, %x --> (%x * %x) U: [0,16130) S: [0,16130) %A = add nuw i16 %x, %x --> (2 * %x) U: [0,255) S: [0,255) Are there any reasons for this behavior? Or is it okay to have those flags for cases mentioned above? Thanks, Lin-Ya -- From: yu810226 at gmail.com 于琳雅 (Lin-Ya Yu) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180814/98c1a784/attachment.html>
Sanjoy Das via llvm-dev
2018-Aug-16 20:10 UTC
[llvm-dev] nuw, nsw flags for SCEVAdd and SCEVMul
I think what you suggest would be a correct enhancement to SCEV, but I thought Tim [CCed] already fixed this in https://reviews.llvm.org/rL336140. -- Sanjoy On Tue, Aug 14, 2018 at 4:28 AM Lin-Ya Yu via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Hi, > > I found out that we do not have nuw and nsw flags for some situations. I ran test cases with range metadata: !2 = !{i16 0, i16 128} > > And I get nuw, nsw flags for > > %A = add i16 %x, 2 > --> (2 + %x)<nuw><nsw> U: [2,130) S: [2,130) > > But for below cases, there are no nuw or nsw flags shown. > > %A = add i16 %x, %x > --> (2 * %x) U: [0,255) S: [0,255) > > %A = mul i16 %x, 2 > --> (2 * %x) U: [0,255) S: [0,255) > > %A = mul i16 %x, %x > --> (%x * %x) U: [0,16130) S: [0,16130) > > From the range we calculated here. Can't we have the flags? > > And for instructions with nuw, I still did not get those flags. > %A = mul nuw i16 %x, %x > --> (%x * %x) U: [0,16130) S: [0,16130) > > %A = add nuw i16 %x, %x > --> (2 * %x) U: [0,255) S: [0,255) > > Are there any reasons for this behavior? Or is it okay to have those flags for cases mentioned above? > > Thanks, > Lin-Ya > > -- > From: yu810226 at gmail.com > 于琳雅 (Lin-Ya Yu) > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev