<br><div class="gmail_quote">thank john,<br>i have used dump() , and each blocks had pred except entery block, i get the following output:<br><br><span style="background-color:rgb(255, 204, 204)">fun main entry</span><br>
entry:<br> %retval = alloca i32<br>
%0 = alloca i32<br> %i = alloca i32<br> %j = alloca i32<br> %a = alloca [2 x i32]<br> %n = alloca i32<br> %t = alloca i32<br> %"alloca point" = bitcast i32 0 to i32<br> %1 = getelementptr inbounds [2 x i32]* %a, i32 0, i32 0<br>
%2 = load i32* getelementptr inbounds ([2 x i32]* @C.0.2045, i32 0, i32 0), align 4<br> store i32 %2, i32* %1, align 4<br> %3 = getelementptr inbounds [2 x i32]* %a, i32 0, i32 1<br> %4 = load i32* getelementptr inbounds ([2 x i32]* @C.0.2045, i32 0, i32 1), align 4<br>
store i32 %4, i32* %3, align 4<br> store i32 2, i32* %n, align 4<br> store i32 0, i32* %j, align 4<br> br label %loop-replace<br><br><span style="background-color: rgb(255, 204, 204);"> fun main loop-replace</span><br>
loop-replace: <span style="background-color: rgb(255, 255, 102);"> ; preds = %entry</span><br>
%5 = alloca [3 x i64]<br> %j_arg = ptrtoint i32* %j to i64<br> %6 = getelementptr [3 x i64]* %5, i64 0, i64 0<br> store i64 %j_arg, i64* %6<br> %t_arg = ptrtoint i32* %t to i64<br> %7 = getelementptr [3 x i64]* %5, i64 0, i64 1<br>
store i64 %t_arg, i64* %7<br> %a_arg = ptrtoint [2 x i32]* %a to i64<br> %8 = getelementptr [3 x i64]* %5, i64 0, i64 2<br> store i64 %a_arg, i64* %8<br> call void @sync_init()<br> %9 = bitcast [3 x i64]* %5 to i64*<br>
call void @sync_delegate(i32 0, i8* (i8*)* @"1_subloop_0", i64* %9)<br> %10 = bitcast [3 x i64]* %5 to i64*<br> call void @sync_delegate(i32 1, i8* (i8*)* @"1_subloop_1", i64* %10)<br> call void @sync_join()<br>
br label %bb5<br><br><span style="background-color: rgb(255, 204, 204);"> fun main bb5</span><br>bb5: <span style="background-color: rgb(255, 255, 153);"> ; preds = %loop-replace</span><br>
%11 = load i32* @sum, align 4<br> store i32 %11, i32* %0, align 4<br> %12 = load i32* %0, align 4<br>
store i32 %12, i32* %retval, align 4<br> br label %return<br><br><span style="background-color: rgb(255, 204, 204);"> fun main return</span><br>return: <span style="background-color: rgb(255, 255, 153);"> ; preds = %bb5</span><br>
%retval6 = load i32* %retval<br> ret i32 %retval6<br>
<br><span style="background-color: rgb(255, 204, 204);"> fun 1_subloop_0 new-entry</span><br><br>new-entry:<br> call void @showPlace()<br> %1 = bitcast i8* %0 to i64*<br> %2 = getelementptr i64* %1, i64 0<br> %j_val = load i64* %2, align 8<br>
call void @showValue(i64 %j_val)<br>
%3 = trunc i64 %j_val to i32<br> %4 = inttoptr i64 %j_val to i32*<br> %5 = getelementptr i64* %1, i64 1<br> %t_val = load i64* %5, align 8<br> call void @showValue(i64 %t_val)<br> %6 = trunc i64 %t_val to i32<br> %7 = inttoptr i64 %t_val to i32*<br>
%8 = getelementptr i64* %1, i64 2<br> %a_val = load i64* %8, align 8<br> call void @showValue(i64 %a_val)<br> %9 = trunc i64 %a_val to i32<br> %10 = inttoptr i64 %a_val to [2 x i32]*<br> br label %bb4_0<br>
<br><span style="background-color: rgb(255, 204, 204);"> fun 1_subloop_0 bb1_0</span><br><br>bb1_0: <span style="background-color: rgb(255, 255, 153);"> ; No predecessors!</span><br>
%c0 = call i64 @sync_consume(i32 0)<br> %c0_val = trunc i64 %c0 to i32<br> %t18_0 = load i32* @p, align 4<br>
br label %bb3_0<br><br><span style="background-color: rgb(255, 204, 204);"> fun 1_subloop_0 bb2_0</span><br>bb2_0: <span style="background-color: rgb(255, 255, 153);">; No predecessors!</span><br>
br label %bb3_0<br><br><br> <br> fun 1_subloop_0 bb3_0<br><br>bb3_0: ; preds = %bb4_0, %bb2_0, %bb1_0<br>
%t3_0 = load i32* %7, align 4<br> %t4_0 = getelementptr inbounds [2 x i32]* %10, i32 0, i32 %t3_0<br> %t5_0 = load i32* %t4_0, align 4<br> %t6_0 = load i32* @sum, align 4<br> %t7_0 = add nsw i32 %t5_0, %t6_0<br> store i32 %t7_0, i32* @sum, align 4<br>
%t9_0 = load i32* @sum, align 4<br> %t10_0 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32 %t9_0) nounwind<br> %t11_0 = load i32* %4, align 4<br> %t12_0 = add nsw i32 %t11_0, 1<br>
store i32 %t12_0, i32* %4, align 4<br> br label %bb4_0<br> <br><span style="background-color: rgb(255, 204, 204);"> fun 1_subloop_0 bb4_0</span><br><br>bb4_0: <span style="background-color: rgb(255, 255, 153);"> ; preds = %bb3_0, %new-entry</span><br>
%t0_0 = load i32* %4, align 4<br>
%t1_0 = icmp sle i32 %t0_0, 9<br> br i1 %t1_0, label %bb3_0, label %new-exit<br> <br><span style="background-color: rgb(255, 204, 204);"> fun 1_subloop_0 new-exit</span><br><br>new-exit: <span style="background-color: rgb(255, 255, 102);"> ; preds = %bb4_0</span><br>
ret i8* null<br>
<br><br><span style="background-color: rgb(255, 204, 204);"> fun 1_subloop_1 new-entry</span><br><br>new-entry:<br> call void @showPlace()<br> %1 = bitcast i8* %0 to i64*<br> %2 = getelementptr i64* %1, i64 0<br>
%j_val = load i64* %2, align 8<br> call void @showValue(i64 %j_val)<br>
%3 = trunc i64 %j_val to i32<br> %4 = inttoptr i64 %j_val to i32*<br> %5 = getelementptr i64* %1, i64 1<br> %t_val = load i64* %5, align 8<br> call void @showValue(i64 %t_val)<br> %6 = trunc i64 %t_val to i32<br> %7 = inttoptr i64 %t_val to i32*<br>
%8 = getelementptr i64* %1, i64 2<br> %a_val = load i64* %8, align 8<br> call void @showValue(i64 %a_val)<br> %9 = trunc i64 %a_val to i32<br> %10 = inttoptr i64 %a_val to [2 x i32]*<br> br label %bb4_1<br><br><span style="background-color: rgb(255, 204, 204);"> fun 1_subloop_1 bb_1</span><br>
bb_1: <span style="background-color: rgb(255, 255, 102);"> ; preds = %bb4_1</span><br> br i1 undef, label %bb1_1, label %bb2_1<br> <br><span style="background-color: rgb(255, 204, 204);"> fun 1_subloop_1 bb1_1</span><br>
<br>bb1_1: <span style="background-color: rgb(255, 255, 102);"> ; preds = %bb_1</span><br>
%t15_1 = load i32* %7, align 4<br> %t16_1 = getelementptr inbounds [2 x i32]* %10, i32 0, i32 %t15_1<br> %t17_1 = load i32* %t16_1, align 4<br> %t19_1 = mul nsw i32 %t17_1, undef<br> %t19_1_64 = sext i32 %t19_1 to i64<br>
call void @sync_produce(i64 %t19_1_64, i32 0)<br> store i32 %t19_1, i32* @p, align 4<br> br label %bb3_1<br> <br><span style="background-color: rgb(255, 204, 204);"> fun 1_subloop_1 bb2_1</span><br><br>bb2_1: <span style="background-color: rgb(255, 255, 102);"> ; preds = %bb_1</span><br>
store i32 1, i32* @p, align 4<br> br label %bb3_1<br><br><span style="background-color: rgb(255, 204, 204);"> fun 1_subloop_1 bb3_1</span><br><br>bb3_1: <span style="background-color: rgb(255, 255, 102);"> ; preds = %bb2_1, %bb1_1</span><br>
br label %bb4_1<br><br> <br><span style="background-color: rgb(255, 204, 204);"> fun 1_subloop_1 bb4_1</span><br>
<br>bb4_1: <span style="background-color: rgb(255, 255, 153);"> ; preds = %bb3_1, %new-entry</span><br> br i1 undef, label %bb_1, label %new-exit<br><br> <br><span style="background-color: rgb(255, 204, 204);"> fun 1_subloop_1 new-exit</span><br>
<br>new-exit: <span style="background-color: rgb(255, 255, 102);">; preds = %bb4_1</span><br>
ret i8* null<br><br>
</div><br>