[SimplifyLibCalls] Fix instruction misplacement in string/memory libcall optimization
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Thu, 1 Oct 2015 22:43:53 +0000 (22:43 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Thu, 1 Oct 2015 22:43:53 +0000 (22:43 +0000)
commite054b9463a61a7955782b48ffbbcb5d9c1ecae2c
tree76e1267e41973026a9163c7733e4dfac10aa6080
parentfb65d2c2417254a45c682c6aafaa0fc15717a503
[SimplifyLibCalls] Fix instruction misplacement in string/memory libcall optimization

When trying to optimize fortified library functions use the right
location to insert new instructions in order to preserve correct
def-use order.

This fixes an issue where a misplaced instruction definition would
happen to be *after* one of its use after a RAUW, forming invalid IR.
This behavior was introduced by r227250.

Differential Revision: http://reviews.llvm.org/D13301

rdar://problem/22802369

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249092 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyLibCalls.cpp
test/Transforms/InstCombine/memset_chk-1.ll