Hi GCC community, This patch will add the missed pattern described in bug 98956 [1] to the match.pd. The codegen and correctness proof for this pattern is here [2,3] in case anyone is curious. Tested on x86_64 Linux.
Tree-optimization/98956: Adding new optimization to match.pd: * match.pd ((B0 << x) cmp 0) -> B0 cmp 0 : New optimization. * gcc.dg/tree-ssa/pr98956.c: testcase for this optimization. * gcc.dg/tree-ssa/pr98956-2.c: testcase for node with side-effect. 1) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98956 2) https://compiler-explorer.com/z/nj4PTrecW 3) https://alive2.llvm.org/ce/z/jyJAoS Best wishes, Navid.
0001-Tree-optimization-98956.patch
Description: 0001-Tree-optimization-98956.patch