In CollectLoopInvariantFixupsAndFormulae(), LSR looks at users outside the loop. E.g. if we have an addrec based on %base, and %base is also used outside the loop, then we have to keep it in a register anyway, which may make it more profitable to use %base + %idx style addressing.
This reasoning doesn't hold up when the base is a constant, because the constant can be rematerialized. The lsr-memcpy.ll regressed when enabling opaque pointer, because inttoptr (i64 6442450944 to ptr) now also has a use outside the loop (previously it didn't due to a pointer type difference), and that extra "use" results in worse use of addressing modes in the loop. However, the use outside the loop actually gets rematerialized, so the alleged register saving does not occur.
This patch opts to skip users of constants entirely for this heuristic. I considered a narrower fix for only inttoptr expressions first, but as this doesn't impact any other tests, it seems better to just handle all constants.