https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103149

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aol...@gcc.gnu.org>:

https://gcc.gnu.org/g:0485ce9128f272fe7ccb48672f69d7be6bb26a9c

commit r12-5831-g0485ce9128f272fe7ccb48672f69d7be6bb26a9c
Author: Alexandre Oliva <ol...@adacore.com>
Date:   Sat Dec 4 00:17:18 2021 -0300

    [PR103149] detach values through mem only if general regs won't do

    When hardening compares or conditional branches, we perform redundant
    tests, and to prevent them from being optimized out, we use asm
    statements that preserve a value used in a compare, but in a way that
    the compiler can no longer assume it's the same value, so it can't
    optimize the redundant test away.

    We used to use +g, but that requires general regs or mem.  You might
    think that, if a reg constraint can't be satisfied, the register
    allocator will fall back to memory, but that's not so: we decide on
    matching MEMs very early on, by using the same addressable operand on
    both input and output, and only if the constraint does not allow
    registers.  If it does, we use gimple registers and then pseudos as
    inputs and outputs, and then inputs can be substituted by equivalent
    expressions, and then, if no register contraint fits (e.g. because
    that mode won't fit in general regs, or won't fit in regs at all), the
    register allocator will give up before even trying to allocate some
    temporary memory to unify input and output.

    This patch arranges for us to create and use the temporary stack slot
    if we can tell the mode requires memory, or won't otherwise fit in
    general regs, and thus to use +m for that asm.


    for  gcc/ChangeLog

            PR middle-end/103149
            * gimple-harden-conditionals.cc (detach_value): Use memory if
            general regs won't do.

    for  gcc/testsuite/ChangeLog

            PR middle-end/103149
            * gcc.target/aarch64/pr103149.c: New.
  • [Bug middle-end/103149] cc1: er... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to