Alive says this is OK
Details
Diff Detail
Event Timeline
This patch LGTM, except for the changes in tryFactorization(). It seems there's some code missing.
lib/Transforms/InstCombine/InstructionCombining.cpp | ||
---|---|---|
633 | This variable is never used. It's defined over the next few lines, but never used to set NUW on the instruction. |
Fix tryFactorization and fix missing test. Surprisingly there seem to be no restriction on the constant value for nuw, like nsw has?
Note for the tryFactorization part, alive times out without a specific type: https://rise4fun.com/Alive/7QM
It works if I specify i8: https://rise4fun.com/Alive/Thy
lib/Transforms/InstCombine/InstructionCombining.cpp | ||
---|---|---|
179–215 | Why does MaintainNoSignedWrap() need all that logic to prove that no overflow happens, |
lib/Transforms/InstCombine/InstructionCombining.cpp | ||
---|---|---|
179–215 | I'm not really sure why MaintainNoSignedWrap has all of those checks. It seems to me like it's looking an overflow that was already illegal? |
This consists of 3 separate changes, it would be easier to review them separately.
lib/Transforms/InstCombine/InstructionCombining.cpp | ||
---|---|---|
179–215 | ||
207 | Maintain is the wrong term then, has NUW flag or something | |
test/Transforms/InstCombine/reassociate-nuw.ll | ||
2 | Can you please precommit using utils/update_test_checks.py ? |
Okay, this looks good to me.
Thanks!
lib/Transforms/InstCombine/InstructionCombining.cpp | ||
---|---|---|
322–328 | I would still recomment bool IsNUW = hasNoUnsignedWrap(I) && hasNoUnsignedWrap(*Op0); bool IsNSW = MaintainNoSignedWrap(I, B, C); ClearSubclassDataAfterReassociation(I); if (IsNUW) I.setHasNoUnsignedWrap(true); |
Maintain is the wrong term then, has NUW flag or something