This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: small varasm.c improvements


>>>>> Zack Weinberg writes:

Zack> Looking at rs6000.c I am suspicious of this bit of rs6000_emit_move:

      else if (mode == Pmode
               && CONSTANT_P (operands[1])
               && ((GET_CODE (operands[1]) != CONST_INT
                    && ! easy_fp_constant (operands[1], mode))
                   || (GET_CODE (operands[1]) == CONST_INT
                       && num_insns_constant (operands[1], mode) > 2)
                   || (GET_CODE (operands[0]) == REG
                       && FP_REGNO_P (REGNO (operands[0]))))
               && GET_CODE (operands[1]) != HIGH
               && ! legitimate_constant_pool_address_p (operands[1])
               && ! toc_relative_expr_p (operands[1]))
        {
          /* Emit a USE operation so that the constant isn't deleted if
             expensive optimizations are turned on because nobody
             references it.  This should only be done for operands that
             contain SYMBOL_REFs with CONSTANT_POOL_ADDRESS_P set.
             This should not be done for operands that contain LABEL_REFs.
             For now, we just handle the obvious case.  */
          if (GET_CODE (operands[1]) != LABEL_REF)
            emit_insn (gen_rtx_USE (VOIDmode, operands[1]));

Zack> That clearly intends to prevent the constant from being deleted *even
Zack> if* nothing uses it, which is precisely what will cause const-elim-1.c
Zack> to fail.  I do not know what the consequences of removing that code
Zack> would be in the large scale, but deleting it gets rid of two of the
Zack> three constants that are being emitted unnecessarily.  The third is
Zack> held in place by this insn

	I believe the issue is that we've swapped the special pool entry
for the original symbol, so there is nothing to prevent the original
symbol from possibly being deleted because the special pool entry has been
substituted everywhere.  The USE makes sure that the symbol being
referenced by the pool is not itself deleted.  Geoff may have some ideas
about whether this is fixable, or maybe we just XFAIL it on rs6000 port.

David


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]