Prazek added a comment. I could use the same IR that I got the bug on, but it will highly depend on how GVN is combining the instructions. Unfortunatelly I don't know any better approach. http://reviews.llvm.org/D13233