diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2009-08-05 07:05:41 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2009-08-05 07:05:41 +0000 |
| commit | a2ce665f603fec12df1293b7d6b13f0cb21f0d78 (patch) | |
| tree | b13d99d9792d32f512c5b884a2f96ffb3ed983e4 /llvm/lib/CodeGen | |
| parent | 98fcfdbf9d02a72301386b6f07fcb0b11bb8d099 (diff) | |
| download | bcm5719-llvm-a2ce665f603fec12df1293b7d6b13f0cb21f0d78.tar.gz bcm5719-llvm-a2ce665f603fec12df1293b7d6b13f0cb21f0d78.zip | |
Another nasty coalescer bug (is there another kind):
After coalescing reg1027's def and kill are both at the same point:
%reg1027,0.000000e+00 = [56,814:0) 0@70-(814)
bb5:
60 %reg1027<def> = t2MOVr %reg1027, 14, %reg0, %reg0
68 %reg1027<def> = t2LDRi12 %reg1027<kill>, 8, 14, %reg0
76 t2CMPzri %reg1038<kill,undef>, 0, 14, %reg0, %CPSR<imp-def>
84 %reg1027<def> = t2MOVr %reg1027, 14, %reg0, %reg0
96 t2Bcc mbb<bb5,0x2030910>, 1, %CPSR<kill>
Do not remove the kill marker on t2LDRi12.
llvm-svn: 78178
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp b/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp index a2d521b139a..08e0bcf85b6 100644 --- a/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp @@ -804,12 +804,26 @@ void SimpleRegisterCoalescing::RemoveUnnecessaryKills(unsigned Reg, for (MachineRegisterInfo::use_iterator UI = mri_->use_begin(Reg), UE = mri_->use_end(); UI != UE; ++UI) { MachineOperand &UseMO = UI.getOperand(); - if (UseMO.isKill()) { - MachineInstr *UseMI = UseMO.getParent(); - unsigned UseIdx = li_->getUseIndex(li_->getInstructionIndex(UseMI)); - const LiveRange *UI = LI.getLiveRangeContaining(UseIdx); - if (!UI || !LI.isKill(UI->valno, UseIdx+1)) + if (!UseMO.isKill()) + continue; + MachineInstr *UseMI = UseMO.getParent(); + unsigned UseIdx = li_->getUseIndex(li_->getInstructionIndex(UseMI)); + const LiveRange *UI = LI.getLiveRangeContaining(UseIdx); + if (!UI || !LI.isKill(UI->valno, UseIdx+1)) { + if (UI->valno->def != UseIdx+1) { + // Interesting problem. After coalescing reg1027's def and kill are both + // at the same point: %reg1027,0.000000e+00 = [56,814:0) 0@70-(814) + // + // bb5: + // 60 %reg1027<def> = t2MOVr %reg1027, 14, %reg0, %reg0 + // 68 %reg1027<def> = t2LDRi12 %reg1027<kill>, 8, 14, %reg0 + // 76 t2CMPzri %reg1038<kill,undef>, 0, 14, %reg0, %CPSR<imp-def> + // 84 %reg1027<def> = t2MOVr %reg1027, 14, %reg0, %reg0 + // 96 t2Bcc mbb<bb5,0x2030910>, 1, %CPSR<kill> + // + // Do not remove the kill marker on t2LDRi12. UseMO.setIsKill(false); + } } } } |

