On Fri, Feb 17, 2017 at 7:12 AM, Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> wrote: > During CSE equivalent instructions should hash to the same value > but we should also try to *not* hash to the same value instructions > that cannot be equivalent. > For commutative ops this means that the hash function should itself > be commutative/symmetrical regarding the exchange of its operands. > This is already the case but the current hash function is symmetrical > for all binops, not only the commutative ones. Thus expressions like > 'a - b' and 'b - a' hash to the same value while it should be the case > only when 'a == b'. > > Fix this by changing the hashing of non-commutative binops so that it > is anti-symmetrical regarding the exchange of operands while keeping > commutative ones symmetrical. > > This change have no functional effects (in the sense that it shoudl > CSE exactly the same instructiosn as before), it should only improve > the efficiency of the hashing+comparing. > > Note: on the 5000+ test set I'm using, I can't see any significant > speedup which is quite normal since most of the functions therein > have (much) less instructions than the size of the hash table. > The effect of this patch should only be on much bigger functions. I apply and push this series to sparse-next. Just curious if there is test case can show the performance increase. As far as I can tell, this patch has down side as well, it hash the non commutative operation *twice*. If for most of the case this actually is the higher cost we might want to keep the old behavior. Chris -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html