ARM: Don't rewrite add reg, $sp, 0 -> mov reg, $sp if the add defines CPSR.
Differential Revision: https://reviews.llvm.org/D43807 llvm-svn: 326226
This commit is contained in:
parent
c0a1291478
commit
e8436e8631
|
@ -489,7 +489,8 @@ bool llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
|
|||
Offset += MI.getOperand(FrameRegIdx+1).getImm();
|
||||
|
||||
unsigned PredReg;
|
||||
if (Offset == 0 && getInstrPredicate(MI, PredReg) == ARMCC::AL) {
|
||||
if (Offset == 0 && getInstrPredicate(MI, PredReg) == ARMCC::AL &&
|
||||
!MI.definesRegister(ARM::CPSR)) {
|
||||
// Turn it into a move.
|
||||
MI.setDesc(TII.get(ARM::tMOVr));
|
||||
MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
; RUN: llc < %s | FileCheck %s
|
||||
|
||||
target triple = "thumbv7-linux-androideabi"
|
||||
|
||||
define i1 @f() {
|
||||
%a = alloca i8*
|
||||
; CHECK: adds.w r0, sp, #0
|
||||
; CHECK: it ne
|
||||
%cmp = icmp ne i8** %a, null
|
||||
ret i1 %cmp
|
||||
}
|
Loading…
Reference in New Issue