On 10/12/26 7:38 AM, Daniel Barboza wrote:
RTL is able to do this optimization but doing it earlier on gimple
can promote further optimizations during tree-opt.

The achieved result is mostly positive with a handful of tests
reporting optimizations being done earlier.  The pattern is being
matched during forwprop so this is an expected result.

A not so good result is pr92080-12.c, where two extra insns ended up
being added in the expected function scanner.  The test seems to care
just with the cfi_* labels so I updated it with the new asm.  The reason
we have extra insns added in the asm seems to be slp being able to
reduce the original code better than what I'm doing with match.pd,
something that I'm not sure if it's expected/acceptable, or a problem
with this match.pd pattern or anything else.

Boostrapped and regression tested in x86_64 and aarch64.

        PR tree-optimization/126523

gcc/ChangeLog:

        * match.pd(`(convert (bit_not (convert A)))`): New pattern.

gcc/testsuite/ChangeLog:

        * gcc.dg/tree-ssa/pr112095.c: 'bf' is now also being simplified
        to "return a"
        * gcc.dg/vect/pr113281-5.c: The signed:16 narrowing in 'f1' is
        now done before the vectorizer
        * gcc.target/i386/pr92080-12.c: Two extra insns ('incl and
        notl') added in the function body.
        * gcc.dg/tree-ssa/pr126523.c: New test.
Well, we need to have a clearer understanding of what's going wrong with that test.  Given its simplicity I would compile it with and without your patch and start comparing dumps to see where things go weird.

Trick.  Dumps tend of have embedded references to the filename.  So take your baseline compiler, build the test with -fdump-tree-all-blocks-details -dap.  Save off the dump files, rebuild with your patch and build the test again with those options.  You can then start looking at the diffs to see where they meaningfully diverge.

I suspect you'll be able to see evidence if your patch in the .optimized dump, which would be normal/expected.  Assuming you see that, I would then move focus to the .combine dump.  Odds are there's a combination we were doing before, but aren't anymore. We'd want to try and figure out why that behavior changed.

jeff

Reply via email to