1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
llvm-mirror/test/Transforms/LICM/convergent.ll
Quentin Colombet c2874d6a67 Prevent LICM and machineLICM from hoisting convergent operations
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
2020-11-06 10:26:39 -08:00

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