[IRSim] Adding support for recognizing branch similarity

Authored by AndrewLitteken on Jul 28 2021, 7:02 AM.


[IRSim] Adding support for recognizing branch similarity

The current IRSimilarityIdentifier does not try to find similarity across blocks, this patch provides a mechanism to compare two branches against one another, to find similarity across basic blocks, rather than just within them.

This adds a step in the similarity identification process that labels all of the basic blocks so that we can identify the relative branching locations. Within an IRSimilarityCandidate we use these relative locations to determine whether if the branching to other relative locations in the same region is the same between branches. If they are, we consider them similar.

We do not consider the relative location of the branch if the target branch is outside of the region. In this case, both branches must exit to a location outside the region, but the exact relative location does not matter.

Reviewers: paquette, yroux

Differential Revision: https://reviews.llvm.org/D106989


AndrewLittekenSep 6 2021, 11:55 AM
Differential Revision
D106989: [IRSim] Finding Branch Similarity
rGd4da4b80258c: [NFC] Added tests for D109283