[PATCH] [InstCombine] mark ADD with nuw if no unsigned overflow
Chandler Carruth
chandlerc at gmail.com
Sat Jun 14 14:47:04 PDT 2014
Cool.
On Sat, Jun 14, 2014 at 10:36 PM, Jingyue Wu <jingyue at google.com> wrote:
> Thanks for your review! I agree with your concerns. computeKnownBits is a
> little expensive. I'm considering merging WillNotOverflowSignedAdd and
> WillNotOverflowUnsignedAdd in a separate patch.
>
> ================
> Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1264
> @@ -1246,1 +1263,3 @@
> }
> + if (!I.hasNoUnsignedWrap() && WillNotOverflowUnsignedAdd(LHS, RHS)) {
> + Changed = true;
> ----------------
> Chandler Carruth wrote:
> > This should be an else if, no? If we succeed at adding NSW, why would we
> check for NUW?
> Even with nsw, there's still value of checking for NUW. e.g., "add i16
> 16383, 16383" can be marked with both nsw and nuw, while "add i16 65535,
> 65535" can be marked with only nsw but not nuw.
>
> http://reviews.llvm.org/D4144
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140614/e9ade02e/attachment.html>
More information about the llvm-commits
mailing list