Don't access dangling reference to reallocated IR.
Merge branch 'master' into agentzh