<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi, <div><br></div><div>I am trying to do a transformation pass in "opt".</div><div>---Snip--</div><div><div>#pragma omp parallel for</div><div>          for (int j=0; j<1000000; j++)</div><div>                b[j] = a[j]*scalar;</div></div><div>---Snip----</div><div> For the above  loop under -fopenmp:<br></div><div>1.  How to check if the loop I am working is a parallel loop (i.e. discover the       "openmp" hint)</div><div>      I tired  Loop->isAnnotatedParallel(),  but  it is returning false. </div><div>2.   Is there some way to discover the original bounds of the loop?</div><div>      I could see the original bounds are passed at the start of the "@.omp_outlined" function.<br></div><div><div>       ---Snip----</div><div>     %0 = bitcast i32* %.<a href="http://omp.lb" target="_blank">omp.lb</a> to i8*</div><div>     call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %0) #4</div><div>     store i32 0, i32* %.<a href="http://omp.lb" target="_blank">omp.lb</a>, align 4, !tbaa !7  <== lower bound </div><div>     %1 = bitcast i32* %.omp.ub to i8*</div><div>     call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %1) #4</div><div>     store i32 999999, i32* %.omp.ub, align 4, !tbaa !7 <== upper bound.</div></div><div>      ---Snip----</div><div><br></div><div>    Now the loop is </div><div>     ---Snip----</div><div>    omp.inner.for.body:                               ; preds = %omp.inner.for.body.preheader, %omp.inner.for.body</div><div>    %indvars.iv = phi i64 [ %8, %omp.inner.for.body.preheader ], [ %indvars.iv.next, %omp.inner.for.body ]</div><div>    .......  </div><div>    %cmp1 = icmp slt i64 %indvars.iv, %9</div><div>    br i1 %cmp1, label %omp.inner.for.body, label %omp.loop.exit </div><div>    ---Snip----</div><div><br></div><div>%8  is lower bound </div><div>%9 is maximum of upper bound and 999999.</div><div><br></div><div>   I could do a backward walk and figure out what the bounds are initially set to? </div><div>   Are there a better ways for doing it example using SCEV ?</div><div> </div><div>regards,</div><div>Venkat.</div><br class="m_-1537813633149323674gmail-Apple-interchange-newline"><div><br></div><div><br></div></div></div></div></div></div></div></div></div>