Skip to content

Commit

Permalink
Revert "Include static prof data when collecting loop BBs"
Browse files Browse the repository at this point in the history
This reverts commit 129c911.

Due to an internal benchmark regression.
  • Loading branch information
hjyamauchi committed Mar 24, 2020
1 parent 9ca6334 commit c341759
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 190 deletions.
4 changes: 0 additions & 4 deletions llvm/include/llvm/CodeGen/MachineLoopInfo.h
Expand Up @@ -67,10 +67,6 @@ class MachineLoop : public LoopBase<MachineBasicBlock, MachineLoop> {
/// it returns an unknown location.
DebugLoc getStartLoc() const;

/// Returns true if a machine loop has blocks that have static profiling
/// information---e.g. from '__builtin_expect()'.
bool hasStaticProfInfo() const;

void dump() const;

private:
Expand Down
11 changes: 3 additions & 8 deletions llvm/lib/CodeGen/MachineBlockPlacement.cpp
Expand Up @@ -2506,14 +2506,9 @@ MachineBlockPlacement::collectLoopBlockSet(const MachineLoop &L) {
// its frequency and the frequency of the loop block. When it is too small,
// don't add it to the loop chain. If there are outer loops, then this block
// will be merged into the first outer loop chain for which this block is not
// cold anymore.
//
// If a block uses static profiling data (e.g. from '__builtin_expect()'),
// then the programmer is explicitly telling us which paths are hot and cold.
// There's no reason for the compiler to believe otherwise, unless
// '-fprofile-use' is specified.
if (F->getFunction().hasProfileData() || ForceLoopColdBlock ||
L.hasStaticProfInfo()) {
// cold anymore. This needs precise profile data and we only do this when
// profile data is available.
if (F->getFunction().hasProfileData() || ForceLoopColdBlock) {
BlockFrequency LoopFreq(0);
for (auto LoopPred : L.getHeader()->predecessors())
if (!L.contains(LoopPred))
Expand Down
7 changes: 0 additions & 7 deletions llvm/lib/CodeGen/MachineLoopInfo.cpp
Expand Up @@ -111,13 +111,6 @@ DebugLoc MachineLoop::getStartLoc() const {
return DebugLoc();
}

bool MachineLoop::hasStaticProfInfo() const {
return llvm::any_of(blocks(), [](const MachineBasicBlock *MBB){
const BasicBlock *BB = MBB->getBasicBlock();
return BB && BB->getTerminator()->hasMetadata(LLVMContext::MD_prof);
});
}

MachineBasicBlock *
MachineLoopInfo::findLoopPreheader(MachineLoop *L,
bool SpeculativePreheader) const {
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/Hexagon/prof-early-if.ll
@@ -1,8 +1,8 @@
; RUN: llc -O2 -march=hexagon < %s | FileCheck %s
; Rely on the comments generated by llc. Check that "if.then" was not predicated.
; CHECK: b5
; CHECK: b2
; CHECK-NOT: if{{.*}}memd
; CHECK: b5

%s.0 = type { [24 x i32], [24 x i32], [24 x i32], [24 x i32], [24 x i32], [24 x i32], [24 x i32], [24 x i32], [24 x i32], [24 x i32], [24 x i32], [24 x i32], [24 x i32], [24 x i32], [24 x i32], [24 x i32], [24 x i32], [3 x i32], [24 x i32], [8 x %s.1], [5 x i32] }
%s.1 = type { i32, i32 }
Expand Down
162 changes: 0 additions & 162 deletions llvm/test/CodeGen/X86/block-placement-2.ll

This file was deleted.

2 changes: 1 addition & 1 deletion llvm/test/CodeGen/X86/block-placement.ll
Expand Up @@ -1502,9 +1502,9 @@ define i32 @not_rotate_if_extra_branch(i32 %count) {
; CHECK: %.header
; CHECK: %.middle
; CHECK: %.backedge
; CHECK: %.slow
; CHECK: %.bailout
; CHECK: %.stop
; CHECK: %.slow
.entry:
%sum.0 = shl nsw i32 %count, 1
br label %.header
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/X86/move_latch_to_loop_top.ll
Expand Up @@ -173,8 +173,8 @@ exit:
;CHECK: %header
;CHECK: %true
;CHECK: %latch
;CHECK: %exit
;CHECK: %false
;CHECK: %exit
define i32 @test4(i32 %t, i32* %p) {
entry:
br label %header
Expand Down
10 changes: 4 additions & 6 deletions llvm/test/CodeGen/X86/ragreedy-bug.ll
Expand Up @@ -10,29 +10,27 @@
; Mem-move
; CHECK-NEXT: movl
; CHECK-NEXT: andl
; CHECK-NEXT: LBB0
; CHECK-NEXT: in Loop
; CHECK-NEXT: testl
; CHECK-NEXT: jne
; CHECK: cond.true.i.i217
; CHECK-NEXT: in Loop
; Mem-move
; CHECK-NEXT: movl
; CHECK-NEXT: andl
; CHECK-NEXT: LBB0
; CHECK-NEXT: in Loop
; CHECK-NEXT: testl
; CHECK-NEXT: je
; CHECK: cond.false.i.i
; CHECK: maskrune
; CHECK-NEXT: movzbl
; CHECK-NEXT: movzbl
; CHECK-NEXT: jmp
; CHECK-NEXT: testl
; CHECK-NEXT: je
; CHECK: cond.false.i.i219
; CHECK: maskrune
; CHECK-NEXT: movzbl
; CHECK-NEXT: movzbl
; CHECK-NEXT: jmp
; CHECK-NEXT: testl
; CHECK-NEXT: jne

%struct.List_o_links_struct = type { i32, i32, i32, %struct.List_o_links_struct* }
%struct.Connector_struct = type { i16, i16, i8, i8, %struct.Connector_struct*, i8* }
Expand Down

0 comments on commit c341759

Please sign in to comment.