https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122018
--- Comment #4 from Hongtao Liu <liuhongt at gcc dot gnu.org> --- (In reply to Hongtao Liu from comment #3) > Maybe we should have a peephole for that, to optimize bts + bt to just bts. And similar for btc/btr? #include <stdbool.h> void g(); int f(int a, int b) { bool t = false; t = a & (1 << b); a = a | (1 << b); if(t) g(); return a; } int f1(int a, int b) { bool t = false; t = a & (1 << b); a = a ^ (1 << b); if(t) g(); return a; } int f2(int a, int b) { bool t = false; t = a & (1 << b); a = a & ~(1 << b); if(t) g(); return a; }