mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-27 13:30:05 +00:00
1ef70ff39b
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224257 91177308-0d34-0410-b5e6-96231b3b80d8
51 lines
1.4 KiB
LLVM
51 lines
1.4 KiB
LLVM
; RUN: opt < %s -analyze -block-freq | FileCheck %s
|
|
|
|
declare void @g(i32 %x)
|
|
|
|
; CHECK-LABEL: Printing analysis {{.*}} for function 'branch_weight_0':
|
|
; CHECK-NEXT: block-frequency-info: branch_weight_0
|
|
define void @branch_weight_0(i32 %a) {
|
|
; CHECK-NEXT: entry: float = 1.0, int = [[ENTRY:[0-9]+]]
|
|
entry:
|
|
br label %for.body
|
|
|
|
; Check that we get 1,4 instead of 0,3.
|
|
; CHECK-NEXT: for.body: float = 4.0,
|
|
for.body:
|
|
%i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
|
|
call void @g(i32 %i)
|
|
%inc = add i32 %i, 1
|
|
%cmp = icmp ugt i32 %inc, %a
|
|
br i1 %cmp, label %for.end, label %for.body, !prof !0
|
|
|
|
; CHECK-NEXT: for.end: float = 1.0, int = [[ENTRY]]
|
|
for.end:
|
|
ret void
|
|
}
|
|
|
|
!0 = !{!"branch_weights", i32 0, i32 3}
|
|
|
|
; CHECK-LABEL: Printing analysis {{.*}} for function 'infinite_loop'
|
|
; CHECK-NEXT: block-frequency-info: infinite_loop
|
|
define void @infinite_loop(i1 %x) {
|
|
; CHECK-NEXT: entry: float = 1.0, int = [[ENTRY:[0-9]+]]
|
|
entry:
|
|
br i1 %x, label %for.body, label %for.end, !prof !1
|
|
|
|
; Check that the loop scale maxes out at 4096, giving 2048 here.
|
|
; CHECK-NEXT: for.body: float = 2048.0,
|
|
for.body:
|
|
%i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
|
|
call void @g(i32 %i)
|
|
%inc = add i32 %i, 1
|
|
br label %for.body
|
|
|
|
; Check that the exit weight is half of entry, since half is lost in the
|
|
; infinite loop above.
|
|
; CHECK-NEXT: for.end: float = 0.5,
|
|
for.end:
|
|
ret void
|
|
}
|
|
|
|
!1 = !{!"branch_weights", i32 1, i32 1}
|