mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
Revert the main portion of r31856. It was causing BranchFolding
to break up CFG diamonds by banishing one of the blocks to the end of the function, which is bad for code density and branch size. This does pessimize MultiSource/Benchmarks/Ptrdist/yacr2, the benchmark cited as the reason for the change, however I've examined the code and it looks more like a case of gaming a particular branch than of being generally applicable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84803 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
49708ad993
commit
6d31268a7d
@ -945,15 +945,15 @@ bool BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this block doesn't fall through (e.g. it ends with an uncond branch or
|
// If this block has no successors (e.g. it is a return block or ends with
|
||||||
// has no successors) and if the pred falls through into this block, and if
|
// a call to a no-return function like abort or __cxa_throw) and if the pred
|
||||||
// it would otherwise fall through into the block after this, move this
|
// falls through into this block, and if it would otherwise fall through
|
||||||
// block to the end of the function.
|
// into the block after this, move this block to the end of the function.
|
||||||
//
|
//
|
||||||
// We consider it more likely that execution will stay in the function (e.g.
|
// We consider it more likely that execution will stay in the function (e.g.
|
||||||
// due to loops) than it is to exit it. This asserts in loops etc, moving
|
// due to loops) than it is to exit it. This asserts in loops etc, moving
|
||||||
// the assert condition out of the loop body.
|
// the assert condition out of the loop body.
|
||||||
if (!PriorCond.empty() && PriorFBB == 0 &&
|
if (MBB->succ_empty() && !PriorCond.empty() && PriorFBB == 0 &&
|
||||||
MachineFunction::iterator(PriorTBB) == FallThrough &&
|
MachineFunction::iterator(PriorTBB) == FallThrough &&
|
||||||
!CanFallThrough(MBB)) {
|
!CanFallThrough(MBB)) {
|
||||||
bool DoTransform = true;
|
bool DoTransform = true;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
; RUN: llc < %s -march=cellspu -o - | grep brz
|
; RUN: llc < %s -march=cellspu -o - | grep brnz
|
||||||
; PR3274
|
; PR3274
|
||||||
|
|
||||||
target datalayout = "E-p:32:32:128-i1:8:128-i8:8:128-i16:16:128-i32:32:128-i64:32:128-f32:32:128-f64:64:128-v64:64:64-v128:128:128-a0:0:128-s0:128:128"
|
target datalayout = "E-p:32:32:128-i1:8:128-i8:8:128-i16:16:128-i32:32:128-i64:32:128-f32:32:128-f64:64:128-v64:64:64-v128:128:128-a0:0:128-s0:128:128"
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
; RUN: grep 1023 %t | count 1
|
; RUN: grep 1023 %t | count 1
|
||||||
; RUN: grep 119 %t | count 1
|
; RUN: grep 119 %t | count 1
|
||||||
; RUN: grep JTI %t | count 2
|
; RUN: grep JTI %t | count 2
|
||||||
; RUN: grep jg %t | count 1
|
; RUN: grep jg %t | count 3
|
||||||
; RUN: grep ja %t | count 1
|
; RUN: grep ja %t | count 1
|
||||||
; RUN: grep js %t | count 1
|
; RUN: grep jns %t | count 1
|
||||||
|
|
||||||
target triple = "i686-pc-linux-gnu"
|
target triple = "i686-pc-linux-gnu"
|
||||||
|
|
||||||
|
@ -74,16 +74,16 @@ exit:
|
|||||||
; CHECK: yet_more_involved:
|
; CHECK: yet_more_involved:
|
||||||
; CHECK: jmp .LBB3_1
|
; CHECK: jmp .LBB3_1
|
||||||
; CHECK-NEXT: align
|
; CHECK-NEXT: align
|
||||||
; CHECK-NEXT: .LBB3_7:
|
; CHECK-NEXT: .LBB3_3:
|
||||||
; CHECK-NEXT: call block_a_true_func
|
|
||||||
; CHECK-NEXT: jmp .LBB3_4
|
|
||||||
; CHECK-NEXT: .LBB3_2:
|
|
||||||
; CHECK-NEXT: call bar99
|
; CHECK-NEXT: call bar99
|
||||||
; CHECK-NEXT: call get
|
; CHECK-NEXT: call get
|
||||||
; CHECK-NEXT: cmpl $2999, %eax
|
; CHECK-NEXT: cmpl $2999, %eax
|
||||||
; CHECK-NEXT: jle .LBB3_7
|
; CHECK-NEXT: jg .LBB3_5
|
||||||
|
; CHECK-NEXT: call block_a_true_func
|
||||||
|
; CHECK-NEXT: jmp .LBB3_6
|
||||||
|
; CHECK-NEXT: .LBB3_5:
|
||||||
; CHECK-NEXT: call block_a_false_func
|
; CHECK-NEXT: call block_a_false_func
|
||||||
; CHECK-NEXT: .LBB3_4:
|
; CHECK-NEXT: .LBB3_6:
|
||||||
; CHECK-NEXT: call block_a_merge_func
|
; CHECK-NEXT: call block_a_merge_func
|
||||||
; CHECK-NEXT: .LBB3_1:
|
; CHECK-NEXT: .LBB3_1:
|
||||||
; CHECK-NEXT: call body
|
; CHECK-NEXT: call body
|
||||||
|
Loading…
Reference in New Issue
Block a user