brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 5427c38 Raw
80 lines · plain
1; RUN: opt -passes=loop-distribute -enable-loop-distribute -verify-loop-info -verify-dom-info -S \2; RUN:   < %s | FileCheck %s3 4; NOTE: The tests below use infinite loops to force unknown backedge-taken counts.5; Making the exit condition depend on a load would break current loop-distribute,6; because it requires all accesses to end up in either of the loops, but not both.7 8; TODO9; Can distribute with unknown backedge-taken count, because no runtime checks are10; required.11define void @unknown_btc_distribute_no_checks_needed(ptr noalias %a, ptr noalias %c, ptr noalias %d) {12; CHECK-LABEL: @unknown_btc_distribute_no_checks_needed(13; CHECK-NEXT:  entry:14; CHECK-NEXT:    br label %for.body15;16entry:17  br label %for.body18 19for.body:                                         ; preds = %for.body, %entry20  %ind = phi i32 [ 0, %entry ], [ %add, %for.body ]21 22  %arrayidxA = getelementptr inbounds i32, ptr %a, i32 %ind23  %loadA = load i32, ptr %arrayidxA, align 424 25  %mulA = mul i32 %loadA, 1026 27  %add = add nuw nsw i32 %ind, 128  %arrayidxA_plus_4 = getelementptr inbounds i32, ptr %a, i32 %add29  store i32 %mulA, ptr %arrayidxA_plus_4, align 430 31  %arrayidxD = getelementptr inbounds i32, ptr %d, i32 %ind32  %loadD = load i32, ptr %arrayidxD, align 433 34  %mulC = mul i32 %loadD, 2035 36  %arrayidxC = getelementptr inbounds i32, ptr %c, i32 %ind37  store i32 %mulC, ptr %arrayidxC, align 438 39  br i1 false, label %for.end, label %for.body40 41for.end:                                          ; preds = %for.body42  ret void43}44 45; Cannot distribute with unknown backedge-taken count, because runtime checks for46; induction wrapping are required.47define void @unknown_btc_do_not_distribute_wrapping_checks(ptr noalias %a, ptr noalias %c, ptr noalias %d) {48; CHECK-LABEL: @unknown_btc_do_not_distribute_wrapping_checks(49; CHECK-NEXT:  entry:50; CHECK-NEXT:    br label %for.body51;52entry:53  br label %for.body54 55for.body:                                         ; preds = %for.body, %entry56  %ind = phi i32 [ 0, %entry ], [ %add, %for.body ]57 58  %arrayidxA = getelementptr inbounds i32, ptr %a, i32 %ind59  %loadA = load i32, ptr %arrayidxA, align 460 61  %mulA = mul i32 %loadA, 1062 63  %add = add i32 %ind, 164  %arrayidxA_plus_4 = getelementptr inbounds i32, ptr %a, i32 %add65  store i32 %mulA, ptr %arrayidxA_plus_4, align 466 67  %arrayidxD = getelementptr inbounds i32, ptr %d, i32 %ind68  %loadD = load i32, ptr %arrayidxD, align 469 70  %mulC = mul i32 %loadD, 2071 72  %arrayidxC = getelementptr inbounds i32, ptr %c, i32 %ind73  store i32 %mulC, ptr %arrayidxC, align 474 75  br i1 false, label %for.end, label %for.body76 77for.end:                                          ; preds = %for.body78  ret void79}80