Fix bugs in struct-reorg and ipa-prefetch (cherry picked from commit fc26f9986570916dcbac9ab14eb61bd3a48e47c6)