<html><body><p><font size="2" face="sans-serif">Hi,</font><br><br><font size="2" face="sans-serif">> </font><font size="3" face="serif">Can  that be used in other places also in second pass?   (</font><font size="3" face="serif"><b>TripCount = EPI.TripCount</b></font><font size="3" face="serif">).</font><br><font size="2" face="sans-serif">Perhaps it could, but I'm not sure why we'd do that? EPI is only available to the interfaces specifically extended for epilogue vectorization, and overwriting TripCount from EPI seems awkward, especially because `getOrCreateTripCount` takes a loop as input. </font><br><br><font size="2" face="sans-serif">> </font><font size="3" face="serif">is it guaranteed that trip count will always dominate the epilog vector loop  and scalar loop ?</font><br><font size="2" face="sans-serif">The `</font><font size="3" face="serif">getOrCreateTripCount` for the original loop is currently first called when generating the first set of tripcount checks in a basic block that dominates the main vector, epilogue vector and the scalar loops. This diagram might help: </font><a href="https://llvm.org/docs/Vectorizers.html#epilogue-vectorization"><font size="3" face="serif">https://llvm.org/docs/Vectorizers.html#epilogue-vectorization</font></a><br><br><font size="2" face="sans-serif">BTW, the community is migrating away from the dev-mailing list in favour of Discourse. Please post future questions to </font><a href="https://llvm.discourse.group/c/ir-optimizations"><font size="2" face="sans-serif">https://llvm.discourse.group/c/ir-optimizations</font></a><font size="2" face="sans-serif">.</font><br><br><font size="2" face="sans-serif">Bardia Mahjour<br>Compiler Optimizations<br>IBM Toronto Software Lab<br></font><br><br><img width="16" height="16" src="cid:1__=8FBB0D45DFFD43B98f9e8a93df938690@ibm.com" border="0" alt="Inactive hide details for "Venkataramanan Kumar" ---2022/01/26 08:20:58 AM---Hi, We are caching TripCount of a loop in"><font size="2" color="#424282" face="sans-serif">"Venkataramanan Kumar" ---2022/01/26 08:20:58 AM---Hi, We are caching TripCount of a loop in</font><br><br><font size="1" color="#5F5F5F" face="sans-serif">From:        </font><font size="1" face="sans-serif">"Venkataramanan Kumar" <venkataramanan.kumar.llvm@gmail.com></font><br><font size="1" color="#5F5F5F" face="sans-serif">To:        </font><font size="1" face="sans-serif">"llvm-dev" <llvm-dev@lists.llvm.org>, "Florian Hahn" <florian_hahn@apple.com>, "Bardia Mahjour" <bmahjour@ca.ibm.com></font><br><font size="1" color="#5F5F5F" face="sans-serif">Date:        </font><font size="1" face="sans-serif">2022/01/26 08:20 AM</font><br><font size="1" color="#5F5F5F" face="sans-serif">Subject:        </font><font size="1" face="sans-serif">[EXTERNAL] Trip count re-computation during Epilog vectorization</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br><font size="1" color="#FFFFFF" face="serif">Hi,  We are caching TripCount of a loop in  "EpilogueLoopVectorizationInfo.TripCount"  during first pass ( Main Loop) vectorization.  I see we use the cached value at "emitMinimumVectorEpilogueIterCountCheck" during the </font><br><br><font size="3" face="serif">Hi, </font><br><br><font size="3" face="serif">We are caching TripCount of a loop in  "EpilogueLoopVectorizationInfo.TripCount"  during first pass ( Main Loop) vectorization. </font><br><font size="3" face="serif">I see we use the cached value at "emitMinimumVectorEpilogueIterCountCheck" during the second pass( Epilog Vector loop).</font><br><br><font size="3" face="serif">--Snip--</font><br><font size="3" face="serif">BasicBlock *<br>EpilogueVectorizerEpilogueLoop::emitMinimumVectorEpilogueIterCountCheck(<br>    Loop *L, BasicBlock *Bypass, BasicBlock *Insert) {<br><br>  assert(EPI.TripCount &&<br>         "Expected trip count to have been safed in the first pass.");<br>  assert(<br>      (!isa<Instruction>(EPI.TripCount) ||<br>       DT->dominates(cast<Instruction>(EPI.TripCount)->getParent(), Insert)) &&<br>      "saved trip count does not dominate insertion point.");<br>  Value *TC = EPI.TripCount;</font><br><font size="3" face="serif"> --Snip--</font><br><br><font size="3" face="serif">Can  that be used in other places also in second pass?   (</font><font size="3" face="serif"><b>TripCount = EPI.TripCount</b></font><font size="3" face="serif">).  In the trunk I see we are recomputing again via getOrCreateTripCount(L)  during the second pass (Epilog vector loop) </font><br><font size="3" face="serif">is it guaranteed that trip count will always dominate the epilog vector loop  and scalar loop ?</font><br><br><font size="3" face="serif">regards,</font><br><font size="3" face="serif">Venkat.</font><br><br><BR>
<BR>
</body></html>