diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-08-18 16:09:47 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-08-18 16:09:47 +0000 |
| commit | 952a621d9378ec19868559a639a3194f6aae51bd (patch) | |
| tree | af7257a99353411f7c918cf21916d526515dbe5a /llvm/lib/CodeGen/PHIElimination.cpp | |
| parent | 396639db95181edc121dba3b1a7ef2c4db22ac37 (diff) | |
| download | bcm5719-llvm-952a621d9378ec19868559a639a3194f6aae51bd.tar.gz bcm5719-llvm-952a621d9378ec19868559a639a3194f6aae51bd.zip | |
Preserve subregs on PHI source operands. Patch by Krister Wombell!
llvm-svn: 111366
Diffstat (limited to 'llvm/lib/CodeGen/PHIElimination.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/PHIElimination.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp index 6595bb98415..ac949098991 100644 --- a/llvm/lib/CodeGen/PHIElimination.cpp +++ b/llvm/lib/CodeGen/PHIElimination.cpp @@ -181,6 +181,7 @@ void llvm::PHIElimination::LowerAtomicPHINode( unsigned NumSrcs = (MPhi->getNumOperands() - 1) / 2; unsigned DestReg = MPhi->getOperand(0).getReg(); + assert(MPhi->getOperand(0).getSubReg() == 0 && "Can't handle sub-reg PHIs"); bool isDead = MPhi->getOperand(0).isDead(); // Create a new register for the incoming PHI arguments. @@ -267,6 +268,8 @@ void llvm::PHIElimination::LowerAtomicPHINode( SmallPtrSet<MachineBasicBlock*, 8> MBBsInsertedInto; for (int i = NumSrcs - 1; i >= 0; --i) { unsigned SrcReg = MPhi->getOperand(i*2+1).getReg(); + unsigned SrcSubReg = MPhi->getOperand(i*2+1).getSubReg(); + assert(TargetRegisterInfo::isVirtualRegister(SrcReg) && "Machine PHI Operands must all be virtual registers!"); @@ -296,7 +299,7 @@ void llvm::PHIElimination::LowerAtomicPHINode( // Insert the copy. if (!reusedIncoming && IncomingReg) BuildMI(opBlock, InsertPos, MPhi->getDebugLoc(), - TII->get(TargetOpcode::COPY), IncomingReg).addReg(SrcReg); + TII->get(TargetOpcode::COPY), IncomingReg).addReg(SrcReg, 0, SrcSubReg); // Now update live variable information if we have it. Otherwise we're done if (!LV) continue; |

