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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Uros Bizjak <u...@gcc.gnu.org>:

https://gcc.gnu.org/g:553b1d3dd5b9253ebdf66ee3260c717d5b807dd1

commit r13-3624-g553b1d3dd5b9253ebdf66ee3260c717d5b807dd1
Author: Uros Bizjak <ubiz...@gmail.com>
Date:   Thu Nov 3 14:17:42 2022 +0100

    i386: Fix uninitialized register after peephole2 conversion [PR107404]

    The eliminate reg-reg move by inverting the condition of
    a cmove #2 peephole2 converts the following sequence:

      473: bx:DI=[r14:DI*0x8+r12:DI]
      960: r15:DI=r8:DI
      485: {flags:CCC=cmp(r15:DI+bx:DI,bx:DI);r15:DI=r15:DI+bx:DI;}
      737: r15:DI={(geu(flags:CCC,0))?r15:DI:bx:DI}

    to:

     1110: {flags:CCC=cmp(r8:DI+bx:DI,bx:DI);r8:DI=r8:DI+bx:DI;}
     1111: r15:DI=[r14:DI*0x8+r12:DI]
     1112: r15:DI={(geu(flags:CCC,0))?r8:DI:r15:DI}

    Please note that(insn 1110) uses register BX, but its
    initialization was eliminated.

    Avoid conversion if eliminated move intialized a register, used
    in the moved instruction.

    2022-11-03  Uroš Bizjak  <ubiz...@gmail.com>

    gcc/ChangeLog:

            PR target/107404
            * config/i386/i386.md (eliminate reg-reg move by inverting the
            condition of a cmove #2 peephole2): Check if eliminated move
            initialized a register, used in the moved instruction.

    gcc/testsuite/ChangeLog:

            PR target/107404
            * g++.target/i386/pr107404.C: New test.

Reply via email to