[llvm-commits] [llvm] r154417 - in /llvm/trunk: lib/CodeGen/SelectionDAG/FastISel.cpp test/CodeGen/ARM/fast-isel-br-const.ll
Eric Christopher
echristo at apple.com
Tue Apr 10 11:18:11 PDT 2012
Author: echristo
Date: Tue Apr 10 13:18:10 2012
New Revision: 154417
URL: http://llvm.org/viewvc/llvm-project?rev=154417&view=rev
Log:
To ensure that we have more accurate line information for a block
don't elide the branch instruction if it's the only one in the block,
otherwise it's ok.
PR9796 and rdar://11215207
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/trunk/test/CodeGen/ARM/fast-isel-br-const.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=154417&r1=154416&r2=154417&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Tue Apr 10 13:18:10 2012
@@ -821,8 +821,11 @@
/// the CFG.
void
FastISel::FastEmitBranch(MachineBasicBlock *MSucc, DebugLoc DL) {
- if (FuncInfo.MBB->isLayoutSuccessor(MSucc)) {
- // The unconditional fall-through case, which needs no instructions.
+
+ if (FuncInfo.MBB->getBasicBlock()->size() > 1 && FuncInfo.MBB->isLayoutSuccessor(MSucc)) {
+ // For more accurate line information if this is the only instruction
+ // in the block then emit it, otherwise we have the unconditional
+ // fall-through case, which needs no instructions.
} else {
// The unconditional branch case.
TII.InsertBranch(*FuncInfo.MBB, MSucc, NULL,
Modified: llvm/trunk/test/CodeGen/ARM/fast-isel-br-const.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fast-isel-br-const.ll?rev=154417&r1=154416&r2=154417&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/fast-isel-br-const.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/fast-isel-br-const.ll Tue Apr 10 13:18:10 2012
@@ -5,7 +5,7 @@
entry:
; THUMB: t1:
; ARM: t1:
-
+ %x = add i32 %a, %b
br i1 1, label %if.then, label %if.else
; THUMB-NOT: b LBB0_1
; ARM-NOT: b LBB0_1
@@ -24,6 +24,7 @@
br label %if.end6
if.else3: ; preds = %if.else
+ %y = sub i32 %a, %b
br i1 1, label %if.then5, label %if.end
; THUMB-NOT: b LBB0_5
; ARM-NOT: b LBB0_5
More information about the llvm-commits
mailing list