[CodeExtractor] Fix sinking of allocas with multiple bitcast uses (PR42451)

An alloca which can be sunk into the extraction region may have more
than one bitcast use. Move these uses along with the alloca to prevent
use-before-def.

Testing: check-llvm, stage2 build of clang

Fixes llvm.org/PR42451.

Differential Revision: https://reviews.llvm.org/D64463

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365660 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vedant Kumar
2019-07-10 16:32:20 +00:00
parent 899d0e6438
commit 0edfaf6dd2
3 changed files with 104 additions and 14 deletions
@@ -45,9 +45,9 @@ bb:
; CHECK-LABEL: define internal void @_Z3foov.1.
; CHECK: newFuncRoot:
; CHECK-NEXT: alloca
; CHECK-NEXT: alloca
; CHECK-NEXT: bitcast
; CHECK-NEXT: call void @llvm.lifetime.start.p0i8
; CHECK-NEXT: alloca
; CHECK-NEXT: bitcast
; CHECK-NEXT: call void @llvm.lifetime.start.p0i8
; CHECK: call void @llvm.lifetime.end.p0i8