xref: /llvm-project/llvm/test/Transforms/LICM/convergent.ll (revision 80e8f2beeb954f8c241897099bb01b24da400e8a)
1; RUN: opt < %s -S -passes=licm | FileCheck %s
2
3; Check that we do not hoist convergent functions out of loop
4; CHECK: define i32 @test
5; CHECK: loop:
6; CHECK: call i32 @f
7
8define i32 @test(ptr nocapture noalias %x, ptr nocapture %y) {
9entry:
10  br label %loop
11
12loop:
13  %a = call i32 @f() nounwind readnone convergent
14  %exitcond = icmp ne i32 %a, 0
15  br i1 %exitcond, label %end, label %loop
16
17end:
18  ret i32 %a
19}
20
21declare i32 @f() nounwind readnone convergent
22