This is an archive of the discontinued LLVM Phabricator instance.

Instcombine ( ( ~A ^ B ) ^ ( A & ~B ) ) to A | ~B
AbandonedPublic

Authored by karthikthecool on Aug 13 2014, 12:58 AM.

Details

Reviewers
majnemer
Summary

Hi David,
Another small patch in instcombine to transform ( ( ~A ^ B ) ^ ( A & ~B ) ) to A | ~B .
Please if you could let me know your i/p's on the same.

Proof-
$ cat t.cvc
A, B : BITVECTOR(32);
QUERY BVXOR(BVXOR(~A, B), (A &~B) ) = A|~B;

$ cvc3 t.cvc
Valid.

Thanks
Karthik Bhat

Diff Detail

Event Timeline

karthikthecool retitled this revision from to Instcombine ( ( ~A ^ B ) ^ ( A & ~B ) ) to A | ~B.
karthikthecool updated this object.
karthikthecool edited the test plan for this revision. (Show Details)
karthikthecool added a reviewer: majnemer.
karthikthecool added a subscriber: Unknown Object (MLST).
majnemer added inline comments.Aug 13 2014, 4:02 PM
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
2546–2569

You have what appear to be eight different patterns you are trying to match but only one test case. Are you sure we need all of them? What happens if you ran a reassociate pass first?

test/Transforms/InstCombine/or-xor.ll
153–161

Please give these variables better names.

Hi David,
Thanks for the review and comments. Yes reassociate does reduce the number of patterns to match. Updated the patch accordingly.
Also updated the test case variable names which was missed out in my previous commit. Please let me know your i/p's on the same.

Thanks once again for your time and support.
Regards
Karthik Bhat

karthikthecool abandoned this revision.Sep 14 2014, 10:45 PM