Ref the post-commit thread for r310770:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170807/478507.html
The motivating cases as 'C' source examples can look like this:
unsigned char rotate_right_8(unsigned char v, int shift) { //shift &= 7; v = ( v >> shift ) | ( v << ( 8 - shift ) ); return v; }
Notice that the source doesn't contain UB-safe masked shift amounts, but instcombine created those in order to produce narrow rotate patterns.
This should be the last step needed to resolve PR34046:
https://bugs.llvm.org/show_bug.cgi?id=34046