The patch is to fix the two bugs reported here: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160418/349985.html
The fix is to allow the dead insts kept in DeadRemat only when they are rematerializable. Because isReallyTriviallyReMaterializableGeneric put many limits on rematerializable instructions, this fix can prevent instructions with tied virtual operands and instructions with virtual register uses from being kept in DeadRemat, so as to fix the problems in the report.
Also add the check "DeadRemat != nullptr" in the condition to put the dead insts in DeadRemat. Because for RegisterCoalescer, its DeadRemat is nullptr, and we want dead instructions in this phase to be eliminated normally.
Don't we already check that MI is triviallyReMaterializable before trying to rematerialize?
I.e., this is just an optimization to keep DeadRemats small, not the actual fix, right?
In other words, if this is the proposed fix, I think I miss something!