From d476afda3880fbb21fc6a72d417f95c258478989 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Fri, 17 Jun 2016 18:40:46 +0000 Subject: [PATCH] ARM: take account of possible bundle when erasing an instruction. Fortunately this appears to be the only ARM-specific pass that runs while bundles might be in play, so no other cases need modifying. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273029 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/Thumb2SizeReduction.cpp | 2 +- test/CodeGen/ARM/thumb2-size-opt.ll | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/Target/ARM/Thumb2SizeReduction.cpp b/lib/Target/ARM/Thumb2SizeReduction.cpp index e1b126650d8..8df85e990d9 100644 --- a/lib/Target/ARM/Thumb2SizeReduction.cpp +++ b/lib/Target/ARM/Thumb2SizeReduction.cpp @@ -461,7 +461,7 @@ Thumb2SizeReduce::ReduceLoadStore(MachineBasicBlock &MBB, MachineInstr *MI, MIB.setMIFlags(MI->getFlags()); // Kill the old instruction. - MI->eraseFromParent(); + MI->eraseFromBundle(); ++NumLdSts; return true; } diff --git a/test/CodeGen/ARM/thumb2-size-opt.ll b/test/CodeGen/ARM/thumb2-size-opt.ll index 0084a456a72..aba027607ea 100644 --- a/test/CodeGen/ARM/thumb2-size-opt.ll +++ b/test/CodeGen/ARM/thumb2-size-opt.ll @@ -82,3 +82,19 @@ entry: %shr = lshr i32 %a, %b ret i32 %shr } + +define i32 @bundled_instruction(i32* %addr, i32** %addr2, i1 %tst) minsize { +; CHECK-LABEL: bundled_instruction: +; CHECK: iteee ne +; CHECK: ldmeq r0!, {{{r[0-9]+}}} + br i1 %tst, label %true, label %false + +true: + ret i32 0 + +false: + %res = load i32, i32* %addr, align 4 + %next = getelementptr i32, i32* %addr, i32 1 + store i32* %next, i32** %addr2 + ret i32 %res +} -- 2.50.1