<div dir="ltr"><div class="gmail_default" style="font-family:monospace">Hello,<br>I am trying to identify from a given CFG for a function, if 2 loops represented in LLVM's loop representation form are identical.<br><br>The simplest definition of identical loops could be loops with <br>1. same initialization<br>2. same trip count[1]<br>3. same increment value<br><br>Comparing 2 loops based on the instructions inside the loop seems problematic for cases when some loop optimizations would try to remove/move instructions out of the loop.<br><br>I was interested to know if there are other methods or already available analysis to find if the 2 loops are identical apart from the above mentioned methods?<br><br>[1] <a href="https://github.com/llvm/llvm-project/blob/e42636d3c1a41a9b7c5d8095ae5ef6682e26d4a2/llvm/lib/Transforms/Scalar/LoopFuse.cpp#L704">https://github.com/llvm/llvm-project/blob/e42636d3c1a41a9b7c5d8095ae5ef6682e26d4a2/llvm/lib/Transforms/Scalar/LoopFuse.cpp#L704</a><br>~/Sameeran</div></div>