[PATCH] D13685: [SCEV] Commute sign extends through nsw additions
Nick Lewycky via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 16 16:23:57 PDT 2015
nlewycky accepted this revision.
nlewycky added a comment.
This revision is now accepted and ready to land.
LGTM, but please do the obvious thing with zext too. I don't feel like the zext tests will need my review, but you can ask me to look at them if you feel otherwise. Thanks for the patch!
================
Comment at: lib/Analysis/ScalarEvolution.cpp:1635-1637
@@ +1634,5 @@
+
+ // sext((A + B + ...)<nsw>) --> (sext(A) + sext(B) + ...)<nsw>
+ if (SA->getNoWrapFlags(SCEV::FlagNSW)) {
+ // If the addition does not sign overflow then we can, by definition,
+ // commute the sign extension with the addition operation.
----------------
Please do. You'll find the functions exceptionally symmetric already. :)
http://reviews.llvm.org/D13685
More information about the llvm-commits
mailing list