While the change itself seems totally reasonable, the output differences in those testcase looks really strange. Can you elaborate a bit on what exactly is going on there? I'd have expected a change like this to be a NOP for any power-of-two values. http://llvm-reviews.chandlerc.com/D2667