Shifts are only isSafeToSpeculativelyExecute if we know the amount we're shifting by is smaller than the bitwidth of the shifted value.
This fixes PR30708
"A shift is undefined if the second operand is equal or larger than the number of bits in the first operand."
Yes... but that's not undefined behavior. LangRef just says "the result is undefined".
This is really inconsistent, both are used.
lib$ grep -R "// TODO" | wc -l
In LangRef "the result is undefined" essentially means "returns undef", like a load from uninitialized memory. There isn't any reason we can't speculate a shift, as long as the result isn't actually used for anything.
I would guess that we're performing a transformation which assumes that "lshr i32 1, %n" returns either 1 or 0, which isn't correct for n >= 32.