[PATCH] D39417: InstCombine: Preserve nuw when reassociating nuw ops [1/3]
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 24 09:27:53 PDT 2019
lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.
Okay, this looks good to me.
Thanks!
================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:338-344
+ bool IsNUW = hasNoUnsignedWrap(I);
+ bool IsNSW = MaintainNoSignedWrap(I, B, C);
+
+ ClearSubclassDataAfterReassociation(I);
+
+ if (IsNUW && hasNoUnsignedWrap(*Op0))
+ I.setHasNoUnsignedWrap(true);
----------------
I would still recomment
```
bool IsNUW = hasNoUnsignedWrap(I) && hasNoUnsignedWrap(*Op0);
bool IsNSW = MaintainNoSignedWrap(I, B, C);
ClearSubclassDataAfterReassociation(I);
if (IsNUW)
I.setHasNoUnsignedWrap(true);
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D39417/new/
https://reviews.llvm.org/D39417
More information about the llvm-commits
mailing list