[PATCH] [InstCombine] mark ADD with nuw if no unsigned overflow

Chandler Carruth chandlerc at gmail.com
Sat Jun 14 11:28:08 PDT 2014

Minor comment, LGTM with the obvious adjustment.

I worry a little about how many times we compute the known sign bits here, but that's nothing new in this patch.

Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1264
@@ -1246,1 +1263,3 @@
+  if (!I.hasNoUnsignedWrap() && WillNotOverflowUnsignedAdd(LHS, RHS)) {
+    Changed = true;
This should be an else if, no? If we succeed at adding NSW, why would we check for NUW?


More information about the llvm-commits mailing list