This patch fixes 2 problems.
- For some instructions that work on SSA values, we check isSafeToExecuteUnconditionally twice in case of hoisting. This is unnecessary.
- For the same set of instructions that work on SSA values, we fail to sink them if they can not meet conditions in isSafeToExecuteUnconditionally. This is a missed opportunity, we can sink these instructions (with no side effects) to the dominated exit blocks, even they do not meet the conditions in isSafeToExecuteUnconditionally. I added a test to demostrate this.
isSafeToExecuteUnconditionally will not be called in this function, is it safe?