summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-06-17 17:59:16 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-06-17 17:59:16 +0000
commit5e4188f1acd814dff1f2155c05576f8892223c40 (patch)
tree6d80882389b54904c1949b15dfc4aaed3b84d29f /llvm/lib/CodeGen
parentf51ed6a161ab4ef7090ec12f84c614130b28415c (diff)
downloadbcm5719-llvm-5e4188f1acd814dff1f2155c05576f8892223c40.tar.gz
bcm5719-llvm-5e4188f1acd814dff1f2155c05576f8892223c40.zip
It's not safe to remove SUBREG_TO_REG that looks like identity copies, e.g. movl %eax, %eax on x86-64 actually does a zero-extend.
llvm-svn: 52421
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/LowerSubregs.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/LowerSubregs.cpp b/llvm/lib/CodeGen/LowerSubregs.cpp
index 296e6d45c34..e2e68d86713 100644
--- a/llvm/lib/CodeGen/LowerSubregs.cpp
+++ b/llvm/lib/CodeGen/LowerSubregs.cpp
@@ -108,20 +108,15 @@ bool LowerSubregsInstructionPass::LowerSubregToReg(MachineInstr *MI) {
DOUT << "subreg: CONVERTING: " << *MI;
- if (DstSubReg == InsReg) {
- // No need to insert an identify copy instruction.
- DOUT << "subreg: eliminated!";
- } else {
- // Insert sub-register copy
- const TargetRegisterClass *TRC0= TRI.getPhysicalRegisterRegClass(DstSubReg);
- const TargetRegisterClass *TRC1= TRI.getPhysicalRegisterRegClass(InsReg);
- TII.copyRegToReg(*MBB, MI, DstSubReg, InsReg, TRC0, TRC1);
+ // Insert sub-register copy
+ const TargetRegisterClass *TRC0= TRI.getPhysicalRegisterRegClass(DstSubReg);
+ const TargetRegisterClass *TRC1= TRI.getPhysicalRegisterRegClass(InsReg);
+ TII.copyRegToReg(*MBB, MI, DstSubReg, InsReg, TRC0, TRC1);
#ifndef NDEBUG
- MachineBasicBlock::iterator dMI = MI;
- DOUT << "subreg: " << *(--dMI);
+ MachineBasicBlock::iterator dMI = MI;
+ DOUT << "subreg: " << *(--dMI);
#endif
- }
DOUT << "\n";
MBB->remove(MI);
OpenPOWER on IntegriCloud