diff options
author | Pete Cooper <peter_cooper@apple.com> | 2015-05-06 22:09:29 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2015-05-06 22:09:29 +0000 |
commit | 54085cdc7b4daf694d85d4de068571e2aeb49923 (patch) | |
tree | f8efc32c1e7c4133eb54e43b6582d819bf6dc2db /llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | |
parent | 30978bb99d5c9fac37d4c56936810179cba371fc (diff) | |
download | bcm5719-llvm-54085cdc7b4daf694d85d4de068571e2aeb49923.tar.gz bcm5719-llvm-54085cdc7b4daf694d85d4de068571e2aeb49923.zip |
Fix incorrect kill flags in fastisel.
If called twice in the same BB on the same constant, FastISel::fastEmit_ri_ was marking the materialized vreg as killed on each use, instead of only the last use.
Change this to only mark the last use as killed by making earlier uses check if the vreg is already used elsewhere.
llvm-svn: 236650
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index 2b624adac94..13f0cb3900f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -1675,6 +1675,7 @@ unsigned FastISel::fastEmit_ri_(MVT VT, unsigned Opcode, unsigned Op0, if (ResultReg) return ResultReg; unsigned MaterialReg = fastEmit_i(ImmType, ImmType, ISD::Constant, Imm); + bool IsImmKill = true; if (!MaterialReg) { // This is a bit ugly/slow, but failing here means falling out of // fast-isel, which would be very slow. @@ -1683,9 +1684,12 @@ unsigned FastISel::fastEmit_ri_(MVT VT, unsigned Opcode, unsigned Op0, MaterialReg = getRegForValue(ConstantInt::get(ITy, Imm)); if (!MaterialReg) return 0; + // If this constant was already materialized, then we don't want to kill it. + // In this case we will have a use. + if (!MRI.use_empty(MaterialReg)) + IsImmKill = false; } - return fastEmit_rr(VT, VT, Opcode, Op0, Op0IsKill, MaterialReg, - /*IsKill=*/true); + return fastEmit_rr(VT, VT, Opcode, Op0, Op0IsKill, MaterialReg, IsImmKill); } unsigned FastISel::createResultReg(const TargetRegisterClass *RC) { |