https://github.com/davemgreen commented: Thanks for looking into this. Could we change it to a check for shift amount > bitwidth? It would feel a little more reliable than checking if the result was folded to undef. https://github.com/llvm/llvm-project/pull/97148