xref: /llvm-project/llvm/test/Transforms/SimpleLoopUnswitch/basictest-profmd.ll (revision 1db2551cc1a356a67c0967f424d6158e2ea127e3)
1; RUN: opt -passes='loop(simple-loop-unswitch),verify<loops>' -S < %s | FileCheck %s
2; RUN: opt -verify-memoryssa -passes='loop-mssa(simple-loop-unswitch),verify<loops>' -S < %s | FileCheck %s
3
4declare void @incf()
5declare void @decf()
6
7define i32 @test2(i32 %c) {
8; CHECK-LABEL: @test2(
9  br label %loop_begin
10
11; CHECK: !prof ![[MD0:[0-9]+]]
12; CHECK: loop_begin:
13; CHECK: !prof ![[MD1:[0-9]+]]
14loop_begin:
15
16  switch i32 %c, label %default [
17      i32 1, label %inc
18      i32 2, label %dec
19  ], !prof !{!"branch_weights", i32 99, i32 1, i32 2}
20
21inc:
22  call void @incf()
23  br label %loop_begin
24
25dec:
26  call void @decf()
27  br label %loop_begin
28
29default:
30  ret i32 0
31}
32
33; CHECK: ![[MD0]] = !{!"branch_weights", i32 99, i32 1, i32 2}
34; CHECK: ![[MD1]] = !{!"branch_weights", i32 2, i32 1}
35