llvm-project/llvm/test/Transforms/LICM/convergent.ll

22 lines
455 B
LLVM

; RUN: opt < %s -S -licm | FileCheck %s
; Check that we do not hoist convergent functions out of loop
; CHECK: define i32 @test
; CHECK: loop:
; CHECK: call i32 @f
define i32 @test(i32* nocapture noalias %x, i32* nocapture %y) {
entry:
br label %loop
loop:
%a = call i32 @f() nounwind readnone convergent
%exitcond = icmp ne i32 %a, 0
br i1 %exitcond, label %end, label %loop
end:
ret i32 %a
}
declare i32 @f() nounwind readnone convergent