[PATCH] D42032: [LLVM][PASSES][InstCombine] Fix (a + a + ...) / a cases

Anton Bikineev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 14 18:43:02 PST 2018


AntonBikineev added a comment.

Hey Roman,
Thanks for the comments.

> 1. Please upload patches with full context (`-U999999`)

Done.

> 2. This needs testing coverage https://bugs.llvm.org/show_bug.cgi?id=35709#c1 notes that "(x+x+x)/x" is already handled, so maybe search for it and look how it is tested? And given that this is a generalization of that, perhaps that one is no longer needed?

The "(x+x+x)/x" case is handled because "(x+x+x)" gets turned into "mul %x, 3" and then another simplification "(x * y) / x -> y" takes place. Things like "x+x" (with power-of-2 number of terms) in turn, get simplified into "shl %x,  constant". So it's not a generalization, but a particular case.


https://reviews.llvm.org/D42032





More information about the llvm-commits mailing list