amehsan added a comment. Thanks Nemanja for comments on the testcase. I will revise the tests. This patch originally being a draft to get feedback on the optimization approach, was not meant to provide finalized and exhaustive test. https://reviews.llvm.org/D25221