Hi,
The following patch implements the tranformation  sub (or A B) (xor A B) -> (and A B). It is similar to the one added in visitAdd()
Z3 Link: http://rise4fun.com/Z3/bNCG
Please help in reviewing it.
Thanks.
Ankur
|  Differential  D5719  
[InstCombineAddSub] Added the transformation - "sub (or A B) (xor A B)  ->  (and A B)" Authored by ankur29.garg on Oct 9 2014, 11:12 PM. 
Details Hi, Z3 Link: http://rise4fun.com/Z3/bNCG Please help in reviewing it. Thanks. 
Diff Detail Event TimelineComment Actions Hi David, Actually, similar tranformation is already present in the VisitAdd() function for add operation. Comment Actions InstCombine is not supposed to handle every possible just because it is theoretically possible case. It's engineered to be a series of engineering tradeoffs. I don't know what the history of the similar transform is in VisitAdd, it's possible that it wasn't added in a principled way. If we were to arbitrarily add patterns, we would eventually make InstCombine cripplingly slow. Comment Actions Hi David, Thanks for the comments. Thanks. Comment Actions 
 
 To be honest, I think this position is unhelpful. A few thoughts: 
 Thanks again, 
 Comment Actions 
 
 To add another anecdote, just when I thought I had classified the kinds of patterns that were occurring in practice, I started looking at instrumented code (address sanitizer, etc.), and I learned that I had a lot left to do. -Hal 
 Comment Actions Hi David,  Although, the link to the commit rL220162 seems to be of another patch. Please update it. Thanks. |