llvm/test/CodeGen/ARM/ifcvt-branch-weight.ll
Manman Ren ea120b6bb5 PGO branch weight: update edge weights in IfConverter.
This commit only handles IfConvertTriangle. To update edge weights
of a successor, one interface is added to MachineBasicBlock:
/// Set successor weight of a given iterator.
setSuccWeight(succ_iterator I, uint32_t weight)

An existing testing case test/CodeGen/Thumb2/v8_IT_5.ll is updated,
since we now correctly update the edge weights, the cold block
is placed at the end of the function and we jump to the cold block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200428 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-29 23:18:47 +00:00

43 lines
1.1 KiB
LLVM

; RUN: llc < %s -mtriple=thumbv8 -print-machineinstrs=if-converter -o /dev/null 2>&1 | FileCheck %s
%struct.S = type { i8* (i8*)*, [1 x i8] }
define internal zeroext i8 @bar(%struct.S* %x, %struct.S* nocapture %y) nounwind readonly {
entry:
%0 = getelementptr inbounds %struct.S* %x, i32 0, i32 1, i32 0
%1 = load i8* %0, align 1
%2 = zext i8 %1 to i32
%3 = and i32 %2, 112
%4 = icmp eq i32 %3, 0
br i1 %4, label %return, label %bb
bb:
%5 = getelementptr inbounds %struct.S* %y, i32 0, i32 1, i32 0
%6 = load i8* %5, align 1
%7 = zext i8 %6 to i32
%8 = and i32 %7, 112
%9 = icmp eq i32 %8, 0
br i1 %9, label %return, label %bb2
; CHECK: BB#2: derived from LLVM BB %bb2
; CHECK: Successors according to CFG: BB#3(192) BB#4(192)
bb2:
%v10 = icmp eq i32 %3, 16
br i1 %v10, label %bb4, label %bb3, !prof !0
bb3:
%v11 = icmp eq i32 %8, 16
br i1 %v11, label %bb4, label %return, !prof !1
bb4:
%v12 = ptrtoint %struct.S* %x to i32
%phitmp = trunc i32 %v12 to i8
ret i8 %phitmp
return:
ret i8 1
}
!0 = metadata !{metadata !"branch_weights", i32 4, i32 12}
!1 = metadata !{metadata !"branch_weights", i32 8, i32 16}