diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-10-10 22:52:53 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-10-10 22:52:53 +0000 |
commit | 0a10cdc7049fbb66033b0384870744949ca29ab8 (patch) | |
tree | 18198393de529cced7001815a0e0952b66350f07 /llvm/lib | |
parent | c7a3107bafeff517d301df8e6cd4bee36afbe5cd (diff) | |
download | bcm5719-llvm-0a10cdc7049fbb66033b0384870744949ca29ab8.tar.gz bcm5719-llvm-0a10cdc7049fbb66033b0384870744949ca29ab8.zip |
If the CPSR is defined by a copy, then we don't want to merge it into an IT
block. E.g., if we have:
movs r1, r1
rsb r1, 0
movs r2, r2
rsb r2, 0
we don't want this to be converted to:
movs r1, r1
movs r2, r2
itt mi
rsb r1, 0
rsb r2, 0
PR11107 & <rdar://problem/10259534>
llvm-svn: 141589
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp b/llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp index 360ec009e20..2bf99bfd5c3 100644 --- a/llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp +++ b/llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp @@ -124,6 +124,28 @@ Thumb2ITBlockPass::MoveCopyOutOfITBlock(MachineInstr *MI, if (Uses.count(DstReg) || Defs.count(SrcReg)) return false; + // If the CPSR is defined by this copy, then we don't want to move it. E.g., + // if we have: + // + // movs r1, r1 + // rsb r1, 0 + // movs r2, r2 + // rsb r2, 0 + // + // we don't want this to be converted to: + // + // movs r1, r1 + // movs r2, r2 + // itt mi + // rsb r1, 0 + // rsb r2, 0 + // + // + for (unsigned I = 0, E = MI->getNumOperands(); I != E; ++I) + if (MI->getOperand(I).isReg() && MI->getOperand(I).getReg() == ARM::CPSR && + MI->getOperand(I).isDef()) + return false; + // Then peek at the next instruction to see if it's predicated on CC or OCC. // If not, then there is nothing to be gained by moving the copy. MachineBasicBlock::iterator I = MI; ++I; |