https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101187
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2021-06-24 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Sth as simple as (simplify (rshift @0 INTEGER_CST@1) (if (TYPE_UNSIGNED (type) && compare_tree_int (@1, element_precision (type)) >= 0) { build_zero_cst (type); })) does the trick. Of course it's quite limited and we could handle undefined left-shifts as well (even arithmetic ones).