ARM: Don't rewrite add reg, $sp, 0 -> mov reg, $sp if the add defines CPSR.

Differential Revision: https://reviews.llvm.org/D43807

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326226 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Peter Collingbourne
2018-02-27 19:00:59 +00:00
parent 5b43e9e5b8
commit 8933ad2b9a
2 changed files with 13 additions and 1 deletions
+2 -1
View File
@@ -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);
+11
View File
@@ -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
}