41 lines · plain
1; RUN: opt -passes=loop-versioning -S < %s | FileCheck %s2 3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"4 5; Do not version this loop because of a convergent operation6 7; CHECK-LABEL: @f(8; CHECK: call i32 @llvm.convergent(9; CHECK-NOT: call i32 @llvm.convergent(10define void @f(ptr %a, ptr %b, ptr %c) #0 {11entry:12 br label %for.body13 14for.body: ; preds = %for.body, %entry15 %ind = phi i64 [ 0, %entry ], [ %add, %for.body ]16 17 %arrayidxA = getelementptr inbounds i32, ptr %a, i64 %ind18 %loadA = load i32, ptr %arrayidxA, align 419 20 %arrayidxB = getelementptr inbounds i32, ptr %b, i64 %ind21 %loadB = load i32, ptr %arrayidxB, align 422 %convergentB = call i32 @llvm.convergent(i32 %loadB)23 24 %mulC = mul i32 %loadA, %convergentB25 26 %arrayidxC = getelementptr inbounds i32, ptr %c, i64 %ind27 store i32 %mulC, ptr %arrayidxC, align 428 29 %add = add nuw nsw i64 %ind, 130 %exitcond = icmp eq i64 %add, 2031 br i1 %exitcond, label %for.end, label %for.body32 33for.end: ; preds = %for.body34 ret void35}36 37declare i32 @llvm.convergent(i32) #138 39attributes #0 = { nounwind convergent }40attributes #1 = { nounwind readnone convergent }41