mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-13 17:20:28 +00:00
![Cong Hou](/assets/img/avatar_default.png)
(This is the second attempt to submit this patch. The first caused two assertion failures and was reverted. See https://llvm.org/bugs/show_bug.cgi?id=25687) The patch in http://reviews.llvm.org/D13745 is broken into four parts: 1. New interfaces without functional changes (http://reviews.llvm.org/D13908). 2. Use new interfaces in SelectionDAG, while in other passes treat probabilities as weights (http://reviews.llvm.org/D14361). 3. Use new interfaces in all other passes. 4. Remove old interfaces. This patch is 3+4 above. In this patch, MBB won't provide weight-based interfaces any more, which are totally replaced by probability-based ones. The interface addSuccessor() is redesigned so that the default probability is unknown. We allow unknown probabilities but don't allow using it together with known probabilities in successor list. That is to say, we either have a list of successors with all known probabilities, or all unknown probabilities. In the latter case, we assume each successor has 1/N probability where N is the number of successors. An assertion checks if the user is attempting to add a successor with the disallowed mixed use as stated above. This can help us catch many misuses. All uses of weight-based interfaces are now updated to use probability-based ones. Differential revision: http://reviews.llvm.org/D14973 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254377 91177308-0d34-0410-b5e6-96231b3b80d8
64 lines
1.9 KiB
LLVM
64 lines
1.9 KiB
LLVM
; RUN: llc < %s -mtriple=armv4t--linux-androideabi -print-machineinstrs=if-converter -o /dev/null 2>&1 | FileCheck %s
|
|
; Fix a bug triggered in IfConverterTriangle when CvtBB has multiple
|
|
; predecessors.
|
|
; PR18752
|
|
|
|
%classK = type { i8, %classF }
|
|
%classF = type { i8 }
|
|
%classL = type { %classG, i32, i32 }
|
|
%classG = type { %classL* }
|
|
%classM2 = type { %classL }
|
|
|
|
define zeroext i1 @test(%classK* %this, %classM2* nocapture readnone %p1, %classM2* nocapture readnone %p2) align 2 {
|
|
entry:
|
|
br i1 undef, label %for.end, label %for.body
|
|
|
|
; Before if conversion, we have
|
|
; for.body -> lor.lhs.false.i (50%)
|
|
; -> for.cond.backedge (50%)
|
|
; lor.lhs.false.i -> for.cond.backedge (100%)
|
|
; -> cond.false.i (0%)
|
|
; Afer if conversion, we have
|
|
; for.body -> for.cond.backedge (100%)
|
|
; -> cond.false.i (0%)
|
|
; CHECK: BB#1: derived from LLVM BB %for.body
|
|
; CHECK: Successors according to CFG: BB#2(0x7ffffc00 / 0x80000000 = 100.00%) BB#4(0x00000400 / 0x80000000 = 0.00%)
|
|
for.body:
|
|
br i1 undef, label %for.cond.backedge, label %lor.lhs.false.i, !prof !1
|
|
|
|
for.cond.backedge:
|
|
%tobool = icmp eq %classL* undef, null
|
|
br i1 %tobool, label %for.end, label %for.body
|
|
|
|
lor.lhs.false.i:
|
|
%tobool.i.i7 = icmp eq i32 undef, 0
|
|
br i1 %tobool.i.i7, label %for.cond.backedge, label %cond.false.i
|
|
|
|
cond.false.i:
|
|
call void @_Z3fn1v()
|
|
unreachable
|
|
|
|
for.end:
|
|
br i1 undef, label %if.else.i.i, label %if.then.i.i
|
|
|
|
if.then.i.i:
|
|
store %classL* null, %classL** undef, align 4
|
|
br label %_ZN1M6spliceEv.exit
|
|
|
|
if.else.i.i:
|
|
store %classL* null, %classL** null, align 4
|
|
br label %_ZN1M6spliceEv.exit
|
|
|
|
_ZN1M6spliceEv.exit:
|
|
%LIS = getelementptr inbounds %classK, %classK* %this, i32 0, i32 1
|
|
call void @_ZN1F10handleMoveEb(%classF* %LIS, i1 zeroext false)
|
|
unreachable
|
|
}
|
|
|
|
declare %classL* @_ZN1M1JI1LS1_EcvPS1_Ev(%classM2*)
|
|
declare void @_ZN1F10handleMoveEb(%classF*, i1 zeroext)
|
|
declare void @_Z3fn1v()
|
|
|
|
!0 = !{!"clang version 3.5"}
|
|
!1 = !{!"branch_weights", i32 62, i32 62}
|