diff options
author | Pete Cooper <peter_cooper@apple.com> | 2015-05-06 22:51:04 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2015-05-06 22:51:04 +0000 |
commit | 27483915e8dd94301f8154a225973931e31f201e (patch) | |
tree | dce6be095c75d9296af708256744ecb64286bd65 /llvm/lib/CodeGen/LivePhysRegs.cpp | |
parent | 3befe94acb6d86cf97a54c3047301bb5c30e9a7c (diff) | |
download | bcm5719-llvm-27483915e8dd94301f8154a225973931e31f201e.tar.gz bcm5719-llvm-27483915e8dd94301f8154a225973931e31f201e.zip |
Handle dead defs in the if converter.
We had code such as this:
r2 = ...
t2Bcc
label1:
ldr ... r2
label2;
return r2<dead, def>
The if converter was transforming this to
r2<def> = ...
return [pred] r2<dead,def>
ldr <r2, kill>
return
which fails the machine verifier because the ldr now reads from a dead def.
The fix here detects dead defs in stepForward and passes them back to the caller in the clobbers list. The caller then clears the dead flag from the def is the value is live.
llvm-svn: 236660
Diffstat (limited to 'llvm/lib/CodeGen/LivePhysRegs.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LivePhysRegs.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/LivePhysRegs.cpp b/llvm/lib/CodeGen/LivePhysRegs.cpp index b6369275051..eef7643367f 100644 --- a/llvm/lib/CodeGen/LivePhysRegs.cpp +++ b/llvm/lib/CodeGen/LivePhysRegs.cpp @@ -77,8 +77,9 @@ void LivePhysRegs::stepForward(const MachineInstr &MI, if (Reg == 0) continue; if (O->isDef()) { - if (!O->isDead()) - Clobbers.push_back(std::make_pair(Reg, &*O)); + // Note, dead defs are still recorded. The caller should decide how to + // handle them. + Clobbers.push_back(std::make_pair(Reg, &*O)); } else { if (!O->isKill()) continue; @@ -90,8 +91,12 @@ void LivePhysRegs::stepForward(const MachineInstr &MI, } // Add defs to the set. - for (auto Reg : Clobbers) + for (auto Reg : Clobbers) { + // Skip dead defs. They shouldn't be added to the set. + if (Reg.second->isReg() && Reg.second->isDead()) + continue; addReg(Reg.first); + } } /// Prin the currently live registers to OS. |