]> granicus.if.org Git - llvm/commit
Clear kill flags in tail duplication.
authorPete Cooper <peter_cooper@apple.com>
Thu, 7 May 2015 21:48:26 +0000 (21:48 +0000)
committerPete Cooper <peter_cooper@apple.com>
Thu, 7 May 2015 21:48:26 +0000 (21:48 +0000)
commite4eff4b23195596e3dc6d1ed8d10450557a36c2b
tree1ef6431582ed7b503fb687b2886792188e09d256
parent97f4d65a0ec40f4da22046161c88111888f02c17
Clear kill flags in tail duplication.

If we duplicate an instruction then we must also clear kill flags on any uses we rewrite.
Otherwise we might be killing a register which was used in other BBs.

For example, here the entry BB ended up with these instructions, the ADD having been tail duplicated.

%vreg24<def> = t2ADDri %vreg10<kill>, 1, pred:14, pred:%noreg, opt:%noreg; GPRnopc:%vreg24 rGPR:%vreg10
%vreg22<def> = COPY %vreg10; GPR:%vreg22 rGPR:%vreg10

The copy here is inserted after the add and so needs vreg10 to be live.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236782 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/TailDuplication.cpp
test/CodeGen/ARM/tail-dup-kill-flags.ll [new file with mode: 0644]