<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">Please avoid double posting.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 24, 2021, at 16:46, Shubham Narlawar via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hello,</div><div class=""><br class=""></div><div class="">I am using a cross compiler built from llvm trunk source.<br class=""></div><div class=""><br class=""></div><div class="">Host - x86</div><div class="">Target - AArch64<br class=""></div><div class=""><br class=""></div><div class="">I am seeing the same loop unroll dump before and after loop unroll pass using flags - "-O2 -funroll-loops". Is there a way to check whether the loop has unrolled or not?</div><div class=""><br class=""></div></div></div></blockquote><div><br class=""></div><div>How are you dumping the IR before/after unrolling? You are comparing the IR after all optimizations, note that `-O2 already enables unrolling, so adding `-funroll-loops` shouldn’t change much. You can disable unrolling though, using `-fno-unroll-loops.` </div><div><br class=""></div><div>To see which loops have been unrolled, you can use optimization remarks, e.g. add ` -Rpass=loop-unroll `(<a href="https://clang.godbolt.org/z/W418qeaGc" class="">https://clang.godbolt.org/z/W418qeaGc</a>)  or `-fsave-optimization-record`. <a href="https://llvm.org/docs/Remarks.html" class="">https://llvm.org/docs/Remarks.html</a></div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">As I am seeing both before and after loop unroll dumps as same, is there a way to dump branch weights? I tried flag "-stats" but I am not getting any warnings or actual branch weights.<br class=""></div></div></div></blockquote><div><br class=""></div>You can take a look at the metadata in LLVM IR (<a href="https://llvm.org/docs/BranchWeightMetadata.html" class="">https://llvm.org/docs/BranchWeightMetadata.html</a>) Not sure if there’s a pass to dump them in a nice way.</div><div><br class=""></div><div><br class=""></div><div>Cheers,</div><div>Florian</div></div></body></html>