The patch removes code from rs6000_secondary_reload_inner that
explicitly called create_TOC_reference on SYMBOL_REF, CONST, and
LABEL_REF involved in a secondary reload. find_reload was choosing an
equivalence of a symbol_ref that referenced the raw data and secondary
reload code was creating a direct reference to the data instead of a
TOC reference, treating the symbol offset as a TOC offset, which was
invalid. This generated code that performed a load from a wild
address and garbage data.
As Uli pointed out, rs6000_emit_move already knows how and when to
create TOC references.
Mike Meissner tested the patch with PPC32 and PPC64 Linux. I have
bootstrapped and tested on powerpc-ibm-aix7.1.0.0. This fixes all of
failures in the GCC VMX testsuite on AIX.
Thanks, David
* config/rs6000/rs6000.c (rs6000_secondary_reload_inner)
[SYMBOL_REF]: Do not explicitly call create_TOC_reference for
TARGET_TOC. Always use rs6000_emit_move.
Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c (revision 218496)
+++ config/rs6000/rs6000.c (working copy)
@@ -17379,12 +17379,7 @@ rs6000_secondary_reload_inner (rtx reg, rtx mem, r
case SYMBOL_REF:
case CONST:
case LABEL_REF:
- if (TARGET_TOC)
- emit_insn (gen_rtx_SET (VOIDmode, scratch,
- create_TOC_reference (addr, scratch)));
- else
- rs6000_emit_move (scratch, addr, Pmode);
-
+ rs6000_emit_move (scratch, addr, Pmode);
new_addr = scratch;
break;