[PATCH] D100095: [InstCombine] Conditionally emitting nsw/nuw flags when combining two add operations

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 11 08:31:24 PDT 2021


nikic requested changes to this revision.
nikic added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3911
+                C, C3, "", BO1->hasNoUnsignedWrap(), BO1->hasNoSignedWrap());
             return new ICmpInst(Pred, A, NewAdd);
           }
----------------
I don't think the nuw preservation is correct if the numbers are negative. Consider this case: https://alive2.llvm.org/ce/z/r3s3bw


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100095/new/

https://reviews.llvm.org/D100095



More information about the llvm-commits mailing list