brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 8a93eb3 Raw
51 lines · plain
1; RUN: opt -passes=loop-load-elim -S < %s | FileCheck %s2 3; Simple st->ld forwarding derived from a lexical forward dep, but4; can't introduce runtime checks with a convergent call.5;6;   for (unsigned i = 0; i < 100; i++) {7;     A[i+1] = convergent(B[i]) + 2;8;     C[i] = A[i] * 2;9;   }10 11target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"12 13; CHECK-LABEL: @f_convergent(14; CHECK: call i32 @llvm.convergent(15; CHECK-NOT: call i32 @llvm.convergent(16define void @f_convergent(ptr %A, ptr %B, ptr %C, i64 %N) #0 {17 18entry:19  br label %for.body20 21for.body:                                         ; preds = %for.body, %entry22  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]23  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 124 25  %Aidx_next = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next26  %Bidx = getelementptr inbounds i32, ptr %B, i64 %indvars.iv27  %Cidx = getelementptr inbounds i32, ptr %C, i64 %indvars.iv28  %Aidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv29 30  %b = load i32, ptr %Bidx, align 431  %convergent.b = call i32 @llvm.convergent(i32 %b)32 33  %a_p1 = add i32 %convergent.b, 234  store i32 %a_p1, ptr %Aidx_next, align 435 36  %a = load i32, ptr %Aidx, align 137  %c = mul i32 %a, 238  store i32 %c, ptr %Cidx, align 439 40  %exitcond = icmp eq i64 %indvars.iv.next, %N41  br i1 %exitcond, label %for.end, label %for.body42 43for.end:                                          ; preds = %for.body44  ret void45}46 47declare i32 @llvm.convergent(i32) #148 49attributes #0 = { nounwind convergent }50attributes #1 = { nounwind readnone convergent }51