[PATCH] D145811: [SystemZ] Don't reuse a sub that can overflow during isel.

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 11 02:17:17 PST 2023


jonpa added inline comments.


================
Comment at: llvm/lib/Target/SystemZ/SystemZISelLowering.cpp:2426
       if (N->getOpcode() == ISD::SUB &&
+          (!N->getFlags().hasNoSignedWrap() && !N->getFlags().hasNoUnsignedWrap()) &&
           ((N->getOperand(0) == C.Op0 && N->getOperand(1) == C.Op1) ||
----------------
nikic wrote:
> It would be better to drop the flags instead -- the general preference is to drop nowrap flags rather than block optimizations due to their presence.
Hmm - I wish I had a better grasp of this.. How is it that we can just drop the nowrap flag and let the program behavior change and print the wrong result?



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

https://reviews.llvm.org/D145811



More information about the llvm-commits mailing list