llvm-project/llvm/test/CodeGen/ARM/ifcvt-branch-weight-bug.ll

64 lines
1.9 KiB
LLVM
Raw Normal View History

; 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 (62)
; -> for.cond.backedge (62)
; lor.lhs.false.i -> for.cond.backedge (1048575)
; -> cond.false.i (1)
; Afer if conversion, we have
; for.body -> for.cond.backedge (130023362)
; -> cond.false.i (62)
; CHECK: BB#1: derived from LLVM BB %for.body
; CHECK: Successors according to CFG: BB#2(130023362) BB#4(62)
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* %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()
IR: Make metadata typeless in assembly Now that `Metadata` is typeless, reflect that in the assembly. These are the matching assembly changes for the metadata/value split in r223802. - Only use the `metadata` type when referencing metadata from a call intrinsic -- i.e., only when it's used as a `Value`. - Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode` when referencing it from call intrinsics. So, assembly like this: define @foo(i32 %v) { call void @llvm.foo(metadata !{i32 %v}, metadata !0) call void @llvm.foo(metadata !{i32 7}, metadata !0) call void @llvm.foo(metadata !1, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{metadata !3}, metadata !0) ret void, !bar !2 } !0 = metadata !{metadata !2} !1 = metadata !{i32* @global} !2 = metadata !{metadata !3} !3 = metadata !{} turns into this: define @foo(i32 %v) { call void @llvm.foo(metadata i32 %v, metadata !0) call void @llvm.foo(metadata i32 7, metadata !0) call void @llvm.foo(metadata i32* @global, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{!3}, metadata !0) ret void, !bar !2 } !0 = !{!2} !1 = !{i32* @global} !2 = !{!3} !3 = !{} I wrote an upgrade script that handled almost all of the tests in llvm and many of the tests in cfe (even handling many `CHECK` lines). I've attached it (or will attach it in a moment if you're speedy) to PR21532 to help everyone update their out-of-tree testcases. This is part of PR21532. llvm-svn: 224257
2014-12-16 03:07:53 +08:00
!0 = !{!"clang version 3.5"}
!1 = !{!"branch_weights", i32 62, i32 62}