Canonicalize
((x + C1) & C2) --> ((x & C2) + C1) ((x + C1) ^ C2) --> ((x ^ C2) + C1) ((x + C1) | C2) --> ((x | C2) + C1)
for suitable constants C1 and C2.
Alive2 proofs: add, or --> or, add
add, xor --> xor, add
add, and --> and, add
Differential D131142
[InstCombine] Canonicalize "and, add", "or, add", "xor, add" emgullufsen on Aug 3 2022, 10:24 PM. Authored by
Details Canonicalize ((x + C1) & C2) --> ((x & C2) + C1) ((x + C1) ^ C2) --> ((x ^ C2) + C1) ((x + C1) | C2) --> ((x | C2) + C1) for suitable constants C1 and C2. Alive2 proofs: add, or --> or, add
Diff Detail
Event TimelineComment Actions Looks good overall.
Comment Actions We need to keep nsw/nuw for add I think.
Comment Actions This patch now does not affect integer-round-up-pow2-alignment.ll (since those changes merged via rGf82c55fa082711f520a7359393b483956b69bf08). So, the NFC changes (changes of variable names) that update_test_checks would make don't have to be addressed at this time (I don't think). I did pull those NFC changes to this test out anyway as D132564, but as said I don't think this needs to be messed with just now. Comment Actions This seems right, but can you verify with Alive2 and add the links to the patch summary. Comment Actions Oh shoot I had meant to include alive2 proofs - sorry for that (and thank you for or/xor proofs) - will get patch summary updated. Comment Actions Sorry for the failed test - I ran update_test_checks against test/Transforms/InstCombine/freeze.ll, Comment Actions To confirm, you just missed updating a test, right? Comment Actions Yes I just missed updating a test that I should have noticed, that actually caused bot failure. But freeze.ll seems to be the only one I missed - check-llvm results look good now. Comment Actions Thanks for reverting @reames - when you have a second maybe you could please have a look over this updated patch? Comment Actions No need. I reverted because of a broken test, if that's been fixed, your LGTM stands. Comment Actions Cool I see - I didn't think I needed to ask for review from reverting dev from Developer Policy, but just wanted to be sure I guess. Thanks again to you and to @spatel for help with proofs and review. Will be more careful with tests in the future.
Comment Actions Sorry to miss provisioning for carrying through nsw/nuw flags before, I am preparing tests/patch to fix this and will add as reviewer. |
The way you've written it is fine. Just remove the comment.