https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77980
Victor Tong <vitong at microsoft dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |vitong at microsoft dot com --- Comment #4 from Victor Tong <vitong at microsoft dot com> --- Would a fix for this be more appropriate in the WPA analysis pass? It seems that if x2 can be proved to be a constant, then all instances of x2 should be replaced with 1 and t1 would get optimized to 0. I tried writing a pattern in match.pd for 1/n but I found that the expression looked like this: x2.0_1 = x2; _2 = x2.0_1 * 2; _3 = 1 / _2; There wasn't any information on x2 so gimple-match wasn't able to reduce the expression. When I alter the definition of x2 to be "const unsigned int" instead of "unsigned int", the code generated by gcc(trunk) and clang(trunk) are equivalent.