[llvm-dev] [loops in LLVM][CFG] Various methods to know weather 2 loops are identical in a given CFG.

sameeran joshi via llvm-dev llvm-dev at lists.llvm.org
Mon May 24 08:39:15 PDT 2021


Hello,
I am trying to identify from a given CFG for a function, if 2 loops
represented in LLVM's loop representation form are identical.

The simplest definition of identical loops could be loops with
1. same initialization
2. same trip count[1]
3. same increment value

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.

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?

[1]
https://github.com/llvm/llvm-project/blob/e42636d3c1a41a9b7c5d8095ae5ef6682e26d4a2/llvm/lib/Transforms/Scalar/LoopFuse.cpp#L704
~/Sameeran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210524/fc1448b3/attachment.html>


More information about the llvm-dev mailing list