The issue happens with:
%0 = ....., !tbaa !0
%1 = ....., !tbaa !1
With !0 that references !1.
In this case when loading !0 we generates a temporary for the
operand !1. We now flush it immediately and trigger the load of
!1 before moving on. If we don't we get the temporary when
attaching to %1. This is usually not an issue except that we
eagerly try to update TBAA MDNodes, which is obviously not possible
if we only have a temporary.
I just noticed that Placeholders is never used in lazyLoadModuleMetadataBlock, so it should probably be removed (in a follow up patch). It does create forward refs so I guess resolveForwardRefsAndPlaceholders below still needs to be invoked, but should it be invoked from within lazyLoadModuleMetadataBlock instead (and passed a dummy PlaceholdersQueue)?