[llvm-dev] nuw, nsw flags for SCEVAdd and SCEVMul

Lin-Ya Yu via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 14 04:28:41 PDT 2018


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>


More information about the llvm-dev mailing list