This code fragment was imported from the Apple branch (it was never applied to mainline). It is stated to fix up a problem sometimes created by reload (before that had been extended to have greater flexibility in assigning the pic registers). In any event, reload is no longer in use for the port.
tested on i686-darwin9, x86_64-darwin16 (m32/m64), applied to mainline, Iain gcc/ChangeLog: 2019-10-13 Iain Sandoe <i...@sandoe.co.uk> * config/darwin.c (machopic_indirect_data_reference): Remove redundant code. diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index f6543fc997..eefffee55f 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -760,21 +760,6 @@ machopic_indirect_data_reference (rtx orig, rtx reg) else if (GET_CODE (orig) == PLUS) { rtx base, result; - /* When the target is i386, this code prevents crashes due to the - compiler's ignorance on how to move the PIC base register to - other registers. (The reload phase sometimes introduces such - insns.) */ - if (GET_CODE (XEXP (orig, 0)) == REG - && REGNO (XEXP (orig, 0)) == PIC_OFFSET_TABLE_REGNUM - /* Prevent the same register from being erroneously used - as both the base and index registers. */ - && (DARWIN_X86 && (GET_CODE (XEXP (orig, 1)) == CONST)) - && reg) - { - emit_move_insn (reg, XEXP (orig, 0)); - XEXP (ptr_ref, 0) = reg; - return ptr_ref; - } /* Legitimize both operands of the PLUS. */ base = machopic_indirect_data_reference (XEXP (orig, 0), reg);