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