Some definitions may be dead before entering the MachineLICM pass. For example, LiveIntervals pass will mark some definition as dead if there is no user of a virtual register. Before the dead definition is eliminated, it is CSE-ed in machineLICM pass, but the dead flag in the duplicated instruction outside of loop is not cleaned, so we get verify error: Virtual register defs don't dominate all uses. (use after it is set to dead)
Create this patch to fix that issue.
Really should not be using const_cast here