mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
c2874d6a67
Results of convergent operations are implicitly affected by the enclosing control flows and should not be hoisted out of arbitrary loops. Patch by Xiaoqing Wu <xiaoqing_wu@apple.com> Differential Revision: https://reviews.llvm.org/D90361
22 lines
455 B
LLVM
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
|