Hi,<div><br></div><div>The compilation of the following code</div><div><br></div><div><div>void f(int *a, int b[], int n)</div><div>{</div><div>  int i;</div><div>  for(i=0; i< n; ++i)</div><div>    a[i] = b[i];</div><div>
}</div><div><br></div><div>gives the IR:</div><div><br></div><div><div>define void @f(i32* nocapture %a, i32* nocapture %b, i32 %n) nounwind {</div><div>  %1 = icmp sgt i32 %n, 0</div><div>  br i1 %1, label %.<a href="http://lr.ph">lr.ph</a>, label %._crit_edge</div>
<div>      </div><div>.<a href="http://lr.ph">lr.ph</a>:                                           ; preds = %0</div><div>  %tmp = zext i32 %n to i64</div><div>  br label %2</div><div><br></div><div>; <label>:2                                       ; preds = %2, %.<a href="http://lr.ph">lr.ph</a></div>
<div>  %indvar = phi i64 [ 0, %.<a href="http://lr.ph">lr.ph</a> ], [ %indvar.next, %2 ]</div><div>  %scevgep = getelementptr i32* %a, i64 %indvar</div><div>  %scevgep2 = getelementptr i32* %b, i64 %indvar</div><div>  %3 = load i32* %scevgep2, align 4, !tbaa !0</div>
<div>  store i32 %3, i32* %scevgep, align 4, !tbaa !0</div><div>  %indvar.next = add i64 %indvar, 1</div><div>  %exitcond = icmp eq i64 %indvar.next, %tmp</div><div>  br i1 %exitcond, label %._crit_edge, label %2</div><div>
  </div><div>._crit_edge:                                      ; preds = %2, %0</div><div>  ret void</div><div>}</div></div><div><br></div><div>My question is how can I identify the first BB in a loop of non-constant trip count? In this example, it is the first BB of the function, which decides whether going to the loop body or not. What's the name of such BBs? For example, some BBs have the name preheader or header, ...</div>
<div><br></div><div>Bo</div><br><br>
</div>