• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -passes='loop(loop-instsimplify,loop-simplifycfg,unswitch),verify<loops>' -S < %s | FileCheck %s
2; RUN: opt -verify-memoryssa -passes='loop-mssa(loop-instsimplify,loop-simplifycfg,unswitch),verify<loops>' -S < %s | FileCheck %s
3
4declare void @some_func() noreturn
5
6define i32 @test1(i32* %var, i1 %cond1, i1 %cond2) {
7; CHECK-LABEL: @test1(
8entry:
9  br label %loop_begin
10; CHECK-NEXT:  entry:
11; CHECK-NEXT:    br i1 %{{.*}}, label %entry.split, label %loop_exit.split
12;
13; CHECK:       entry.split:
14; CHECK-NEXT:    br i1 %{{.*}}, label %entry.split.split, label %loop_exit
15;
16; CHECK:       entry.split.split:
17; CHECK-NEXT:    br label %loop_begin
18
19loop_begin:
20  br i1 %cond1, label %continue, label %loop_exit ; first trivial condition
21
22continue:
23  %var_val = load i32, i32* %var
24  %var_cond = trunc i32 %var_val to i1
25  %maybe_cond = select i1 %cond1, i1 %cond2, i1 %var_cond
26  br i1 %maybe_cond, label %do_something, label %loop_exit ; second trivial condition
27
28do_something:
29  call void @some_func() noreturn nounwind
30  br label %loop_begin
31; CHECK:       loop_begin:
32; CHECK-NEXT:    call
33; CHECK-NEXT:    br label %loop_begin
34
35loop_exit:
36  ret i32 0
37; CHECK:       loop_exit:
38; CHECK-NEXT:    br label %loop_exit.split
39;
40; CHECK:       loop_exit.split:
41; CHECK-NEXT:    ret
42}
43