The motivation for this is that I'm looking at an example that uses shifts as induction variables. There's lots of other omissions, but one of the first I noticed is that we can't compute tight known bits. (This indirectly causes SCEV's range analysis to produce very poor results as well.)
One specific question to reviewers. This patch essentially treats all shifts as if they were not exact/nsw/nuw. This is a valid interpretation, but I'm concerned it might differ from that taken elsewhere in the optimizer in a problematic way. What is the best practice for this in known bits computation?
Compile time wise, this should be reasonable. We locally match the recurrence using simple IR pattern matching, and only recurse on the operand once we found a recurrence.
The context instruction here needs to be adjusted to the terminator of the block for the incoming value StartV. Context can't be preserved when looking through phis.