Fix #1226: Store minimal info in IR to construct hierarchy

Private method to factor out these 4 lines, please.