On Tue, Sep 03, 2019 at 05:56:03PM -0500, Segher Boessenkool wrote: > Hi! > > On Mon, Aug 26, 2019 at 05:43:41PM -0400, Michael Meissner wrote: > > /* This file implements a RTL pass that looks for pc-relative loads of the > > address of an external variable using the PCREL_GOT relocation and a > > single > > load/store that uses that GOT pointer. > > Does this work better than having a peephole for it? Is there some reason > you cannot do this with a peephole?
Yes. Peepholes only look at adjacent insns. This optimization allows the load of the GOT address to be separated from the eventual load or store. Peephole2's are likely too early, because you really, really, really don't want any other pass moving things around. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meiss...@linux.ibm.com, phone: +1 (978) 899-4797