This is a continuation (I couldn't update the phab review) from http://reviews.llvm.org/D6995 (Original Patch by Mehdi)
Before we Optimize instruction, make sure all instructions that are in the redo list and are before the current instruction have been optimized.