Radar 8803471: Fix expansion of ARM BCCi64 pseudo instructions.
authorBob Wilson <bob.wilson@apple.com>
Thu, 23 Dec 2010 22:45:49 +0000 (22:45 +0000)
committerBob Wilson <bob.wilson@apple.com>
Thu, 23 Dec 2010 22:45:49 +0000 (22:45 +0000)
If the basic block containing the BCCi64 (or BCCZi64) instruction ends with
an unconditional branch, that branch needs to be deleted before appending
the expansion of the BCCi64 to the end of the block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122521 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMISelLowering.cpp
test/CodeGen/ARM/fpcmp-opt.ll

index d4f146232ea0fd5a0221cbaefe6b70711ee4a4c8..22b3b431deba6c712c94e2f34f6c5de85a5c53b5 100644 (file)
@@ -4433,6 +4433,9 @@ ARMTargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
 
   case ARM::BCCi64:
   case ARM::BCCZi64: {
+    // If there is an unconditional branch to the other successor, remove it.
+    BB->erase(llvm::next(MachineBasicBlock::iterator(MI)), BB->end());
+    
     // Compare both parts that make up the double comparison separately for
     // equality.
     bool RHSisZero = MI->getOpcode() == ARM::BCCZi64;
index 64350591b87f1188095136126a51b0f08183b1ee..65b921bdf655fcb64746cb0506edb6f28977ee01 100644 (file)
@@ -38,6 +38,7 @@ entry:
 ; FINITE: t2:
 ; FINITE-NOT: vldr
 ; FINITE: ldrd r0, [r0]
+; FINITE-NOT: b LBB
 ; FINITE: cmp r0, #0
 ; FINITE: cmpeq r1, #0
 ; FINITE-NOT: vcmpe.f32