[PATCH] D48853: [SCEV] Add zext(C + x + ...) -> D + zext(C-D + x + ...)<nuw> transform

Roman Tereshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 9 23:53:42 PDT 2018


rtereshin added inline comments.


================
Comment at: test/Analysis/ScalarEvolution/no-wrap-add-exprs.ll:150
+; CHECK:  %p1.zext = zext i8 %p1 to i16
+; CHECK-NEXT:  -->  (zext i8 (8 + (4 * %x)) to i16) U: [0,253) S: [0,256)
+
----------------
rtereshin wrote:
> mkazantsev wrote:
> > Its weird. Why signed and unsigned ranges are different?
> That's a good question. One thing I know is that the issue is orthogonal to this patch and exists on trunk:
> 
> ```
>   %p1.zext = zext i8 %p1 to i16
>   -->  (zext i8 (8 + (4 * %x)) to i16) U: [0,253) S: [0,256)
> ```
> (this is w/o this patch applied)
> 
> Perhaps unsigned range takes some knownbits-like information into account, while signed one doesn't.
Maybe this is the spot: https://github.com/llvm-mirror/llvm/blob/650cfa6dc060acb5b4c9571d454ec2b990aad648/lib/Analysis/ScalarEvolution.cpp#L5594-L5613


Repository:
  rL LLVM

https://reviews.llvm.org/D48853





More information about the llvm-commits mailing list