1. The metadata objects weren't being duplicated when duplicating the IR. This meant that the later passes would write metadata multiples times into one store (reference), causing wrong behaviour at codegen time.