Hi! This testcase was fixed by Segher's r254875: https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00340.html on the trunk, so I've committed it to trunk as obvious. On release branches it still needs fixing.
2017-11-28 Jakub Jelinek <ja...@redhat.com> PR rtl-optimization/81020 * gcc.dg/pr81020.c: New test. --- gcc/testsuite/gcc.dg/pr81020.c.jj 2017-11-27 18:49:06.659907687 +0100 +++ gcc/testsuite/gcc.dg/pr81020.c 2017-11-27 18:49:00.431982443 +0100 @@ -0,0 +1,23 @@ +/* PR rtl-optimization/81020 */ +/* { dg-do run } */ +/* { dg-options "-O -fno-tree-bit-ccp -fno-tree-coalesce-vars -fno-tree-vrp" } */ + +unsigned v = 4; + +unsigned long long __attribute__((noipa)) +foo (unsigned x) +{ + unsigned a = v; + a &= 1; + x |= 0 < a; + a >>= 31; + return x + a; +} + +int +main () +{ + if (foo (2) != 2) + __builtin_abort (); + return 0; +} Jakub