[IRSim] Check largest sections first when analyzing similarity
authorAndrew Litteken <andrew.litteken@gmail.com>
Sun, 2 Oct 2022 17:34:14 +0000 (12:34 -0500)
committerAndrew Litteken <andrew.litteken@gmail.com>
Mon, 20 Mar 2023 23:27:44 +0000 (18:27 -0500)
commit805ec19d7d9915989be8a8a626176b5e29e19eee
treeb20fe56fb1a792e89fbe5cec9147acfc18d37a60
parent402dd79a293dc23f0ccf521d79386880e4969584
[IRSim] Check largest sections first when analyzing similarity

When we check for similarity, right now there is no order to how it is checked, except for via the suffix tree ordering.

We can reduce how much structural analysis we perform by checking the the regions in decreasing size. In doing so, we know that if two large sections match, each of their contained regions also match. This allows us to skip the structural checking for each smaller section. IT does require that we use the large regions as a "bridge" to create the canonical mapping between the two regions.

This reduces compile time significantly for some benchmarks. It will not perform as well for programs with many small items.

Reviewer: paquette
Differential Revision: https://reviews.llvm.org/D139338
llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
llvm/lib/Analysis/IRSimilarityIdentifier.cpp
llvm/test/Transforms/IROutliner/illegal-assumes.ll