1 ; RUN: opt -basicaa -loop-versioning -S < %s | FileCheck %s
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
5 ; Do not version this loop because of a convergent operation
8 ; CHECK: call i32 @llvm.convergent(
9 ; CHECK-NOT: call i32 @llvm.convergent(
10 define void @f(i32* %a, i32* %b, i32* %c) #0 {
14 for.body: ; preds = %for.body, %entry
15 %ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
17 %arrayidxA = getelementptr inbounds i32, i32* %a, i64 %ind
18 %loadA = load i32, i32* %arrayidxA, align 4
20 %arrayidxB = getelementptr inbounds i32, i32* %b, i64 %ind
21 %loadB = load i32, i32* %arrayidxB, align 4
22 %convergentB = call i32 @llvm.convergent(i32 %loadB)
24 %mulC = mul i32 %loadA, %convergentB
26 %arrayidxC = getelementptr inbounds i32, i32* %c, i64 %ind
27 store i32 %mulC, i32* %arrayidxC, align 4
29 %add = add nuw nsw i64 %ind, 1
30 %exitcond = icmp eq i64 %add, 20
31 br i1 %exitcond, label %for.end, label %for.body
33 for.end: ; preds = %for.body
37 declare i32 @llvm.convergent(i32) #1
39 attributes #0 = { nounwind convergent }
40 attributes #1 = { nounwind readnone convergent }