LLVM 19.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::IRSimilarity::IRSimilarityCandidate Class Reference

This is a class that wraps a range of IRInstructionData from one point to another in the vector of IRInstructionData, which is a region of the program. More...

#include "llvm/Analysis/IRSimilarityIdentifier.h"

Classes

struct  OperandMapping
 
struct  RelativeLocMapping
 A helper struct to hold the candidate, for a branch instruction, the relative location of a label, and the label itself. More...
 

Public Types

using iterator = IRInstructionDataList::iterator
 

Public Member Functions

 IRSimilarityCandidate (unsigned StartIdx, unsigned Len, IRInstructionData *FirstInstIt, IRInstructionData *LastInstIt)
 
void createCanonicalRelationFrom (IRSimilarityCandidate &SourceCand, DenseMap< unsigned, DenseSet< unsigned > > &ToSourceMapping, DenseMap< unsigned, DenseSet< unsigned > > &FromSourceMapping)
 Create a mapping for the value numbering of the calling IRSimilarityCandidate, to a different separate set of numbers, based on the canonical ordering in SourceCand.
 
void createCanonicalRelationFrom (IRSimilarityCandidate &SourceCand, DenseMap< unsigned, unsigned > &OneToOne, DenseMap< unsigned, DenseSet< unsigned > > &ToSourceMapping, DenseMap< unsigned, DenseSet< unsigned > > &FromSourceMapping)
 Create a mapping for the value numbering of the calling IRSimilarityCandidate, to a different separate set of numbers, based on the canonical ordering in SourceCand.
 
void createCanonicalRelationFrom (IRSimilarityCandidate &SourceCand, IRSimilarityCandidate &SourceCandLarge, IRSimilarityCandidate &TargetCandLarge)
 Create a mapping for the value numbering of the calling IRSimilarityCandidate, to a different separate set of numbers, based on the canonical ordering in SourceCand.
 
void getBasicBlocks (DenseSet< BasicBlock * > &BBSet) const
 
void getBasicBlocks (DenseSet< BasicBlock * > &BBSet, SmallVector< BasicBlock * > &BBList) const
 
unsigned getLength () const
 
unsigned getStartIdx () const
 
unsigned getEndIdx () const
 
IRInstructionDatafront () const
 
IRInstructionDataback () const
 
InstructionfrontInstruction ()
 
InstructionbackInstruction ()
 
BasicBlockgetStartBB ()
 
BasicBlockgetEndBB ()
 
FunctiongetFunction ()
 
std::optional< unsignedgetGVN (Value *V)
 Finds the positive number associated with V if it has been mapped.
 
std::optional< Value * > fromGVN (unsigned Num)
 Finds the Value associate with Num if it exists.
 
std::optional< unsignedgetCanonicalNum (unsigned N)
 Find the canonical number from the global value number N stored in the candidate.
 
std::optional< unsignedfromCanonicalNum (unsigned N)
 Find the global value number from the canonical number N stored in the candidate.
 
bool operator< (const IRSimilarityCandidate &RHS) const
 
iterator begin () const
 
iterator end () const
 

Static Public Member Functions

static bool isSimilar (const IRSimilarityCandidate &A, const IRSimilarityCandidate &B)
 
static bool compareStructure (const IRSimilarityCandidate &A, const IRSimilarityCandidate &B)
 
static bool compareStructure (const IRSimilarityCandidate &A, const IRSimilarityCandidate &B, DenseMap< unsigned, DenseSet< unsigned > > &ValueNumberMappingA, DenseMap< unsigned, DenseSet< unsigned > > &ValueNumberMappingB)
 
static bool compareNonCommutativeOperandMapping (OperandMapping A, OperandMapping B)
 Compare the operands in A and B and check that the current mapping of global value numbers from A to B and B to \A is consistent.
 
static bool compareCommutativeOperandMapping (OperandMapping A, OperandMapping B)
 Compare the operands in A and B and check that the current mapping of global value numbers from A to B and B to \A is consistent given that the operands are commutative.
 
static bool compareAssignmentMapping (const unsigned InstValA, const unsigned &InstValB, DenseMap< unsigned, DenseSet< unsigned > > &ValueNumberMappingA, DenseMap< unsigned, DenseSet< unsigned > > &ValueNumberMappingB)
 Compare the GVN of the assignment value in corresponding instructions in IRSimilarityCandidates A and B and check that there exists a mapping between the values and replaces the mapping with a one-to-one value if needed.
 
static bool checkRelativeLocations (RelativeLocMapping A, RelativeLocMapping B)
 Compare the relative locations in A and B and check that the distances match if both locations are contained in the region, and that the branches both point outside the region if they do not.
 
static void createCanonicalMappingFor (IRSimilarityCandidate &CurrCand)
 Create a mapping from the value numbering to a different separate set of numbers.
 
static bool overlap (const IRSimilarityCandidate &A, const IRSimilarityCandidate &B)
 Compare the start and end indices of the two IRSimilarityCandidates for whether they overlap.
 

Detailed Description

This is a class that wraps a range of IRInstructionData from one point to another in the vector of IRInstructionData, which is a region of the program.

It is also responsible for defining the structure within this region of instructions.

The structure of a region is defined through a value numbering system assigned to each unique value in a region at the creation of the IRSimilarityCandidate.

For example, for each Instruction we add a mapping for each new value seen in that Instruction. IR: Mapping Added: add1 = add i32 a, c1 add1 -> 3, a -> 1, c1 -> 2 add2 = add i32 a, %1 add2 -> 4 add3 = add i32 c2, c1 add3 -> 6, c2 -> 5

We can compare IRSimilarityCandidates against one another. The isSimilar function compares each IRInstructionData against one another and if we have the same sequences of IRInstructionData that would create the same hash, we have similar IRSimilarityCandidates.

We can also compare the structure of IRSimilarityCandidates. If we can create a mapping of registers in the region contained by one IRSimilarityCandidate to the region contained by different IRSimilarityCandidate, they can be considered structurally similar.

IRSimilarityCandidate1: IRSimilarityCandidate2: add1 = add i32 a, b add1 = add i32 d, e add2 = add i32 a, c add2 = add i32 d, f add3 = add i32 c1, c2 add3 = add i32 c3, c4

Can have the following mapping from candidate to candidate of: a -> d, b -> e, c -> f, c1 -> c3, c2 -> c4 and can be considered similar.

IRSimilarityCandidate1: IRSimilarityCandidate2: add1 = add i32 a, b add1 = add i32 d, c4 add2 = add i32 a, c add2 = add i32 d, f add3 = add i32 c1, c2 add3 = add i32 c3, c4

We cannot create the same mapping since the use of c4 is not used in the same way as b or c2.

Definition at line 654 of file IRSimilarityIdentifier.h.

Member Typedef Documentation

◆ iterator

Definition at line 1011 of file IRSimilarityIdentifier.h.

Constructor & Destructor Documentation

◆ IRSimilarityCandidate()

IRSimilarityCandidate::IRSimilarityCandidate ( unsigned  StartIdx,
unsigned  Len,
IRInstructionData FirstInstIt,
IRInstructionData LastInstIt 
)
Parameters
StartIdx- The starting location of the region.
Len- The length of the region.
FirstInstIt- The starting IRInstructionData of the region.
LastInstIt- The ending IRInstructionData of the region.

Definition at line 427 of file IRSimilarityIdentifier.cpp.

References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::contains(), getBasicBlocks(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::try_emplace().

Member Function Documentation

◆ back()

IRInstructionData * llvm::IRSimilarity::IRSimilarityCandidate::back ( ) const
inline
Returns
The last IRInstructionData.

Definition at line 939 of file IRSimilarityIdentifier.h.

Referenced by end().

◆ backInstruction()

Instruction * llvm::IRSimilarity::IRSimilarityCandidate::backInstruction ( )
inline

◆ begin()

iterator llvm::IRSimilarity::IRSimilarityCandidate::begin ( ) const
inline

◆ checkRelativeLocations()

bool IRSimilarityCandidate::checkRelativeLocations ( RelativeLocMapping  A,
RelativeLocMapping  B 
)
static

Compare the relative locations in A and B and check that the distances match if both locations are contained in the region, and that the branches both point outside the region if they do not.

Example Region:

entry:
br i1 %0, label %block_1, label %block_3
block_0:
br i1 %0, label %block_1, label %block_2
block_1:
br i1 %0, label %block_2, label %block_3
block_2:
br i1 %1, label %block_1, label %block_4
block_3:
br i1 %2, label %block_2, label %block_5

If we compare the branches in block_0 and block_1 the relative values are 1 and 2 for both, so we consider this a match.

If we compare the branches in entry and block_0 the relative values are 2 and 3, and 1 and 2 respectively. Since these are not the same we do not consider them a match.

If we compare the branches in block_1 and block_2 the relative values are 1 and 2, and -1 and None respectively. As a result we do not consider these to be the same

If we compare the branches in block_2 and block_3 the relative values are -1 and None for both. We do consider these to be a match.

Parameters
A- The first IRInstructionCandidate, relative location value, and incoming block.
B- The second IRInstructionCandidate, relative location value, and incoming block.
Returns
true if the relative locations match.

Definition at line 749 of file IRSimilarityIdentifier.cpp.

References A, B, and llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains().

Referenced by compareStructure().

◆ compareAssignmentMapping()

bool IRSimilarityCandidate::compareAssignmentMapping ( const unsigned  InstValA,
const unsigned InstValB,
DenseMap< unsigned, DenseSet< unsigned > > &  ValueNumberMappingA,
DenseMap< unsigned, DenseSet< unsigned > > &  ValueNumberMappingB 
)
static

Compare the GVN of the assignment value in corresponding instructions in IRSimilarityCandidates A and B and check that there exists a mapping between the values and replaces the mapping with a one-to-one value if needed.

Parameters
InstValA- The assignment GVN from the first IRSimilarityCandidate.
InstValB- The assignment GVN from the second IRSimilarityCandidate.
[in,out]ValueNumberMappingA- A mapping of value numbers from candidate A to candidate \B.
[in,out]ValueNumberMappingB- A mapping of value numbers from candidate B to candidate \A.
Returns
true if the IRSimilarityCandidates assignments are compatible.

Definition at line 721 of file IRSimilarityIdentifier.cpp.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::contains(), contains(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size().

Referenced by compareStructure().

◆ compareCommutativeOperandMapping()

bool IRSimilarityCandidate::compareCommutativeOperandMapping ( OperandMapping  A,
OperandMapping  B 
)
static

Compare the operands in A and B and check that the current mapping of global value numbers from A to B and B to \A is consistent given that the operands are commutative.

Parameters
A- The first IRInstructionCandidate, operand values, and current operand mappings to compare.
B- The second IRInstructionCandidate, operand values, and current operand mappings to compare.
Returns
true if the IRSimilarityCandidates operands are compatible.

Definition at line 686 of file IRSimilarityIdentifier.cpp.

References A, B, checkNumberingAndReplaceCommutative(), Idx, and llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert().

Referenced by compareStructure().

◆ compareNonCommutativeOperandMapping()

bool IRSimilarityCandidate::compareNonCommutativeOperandMapping ( OperandMapping  A,
OperandMapping  B 
)
static

Compare the operands in A and B and check that the current mapping of global value numbers from A to B and B to \A is consistent.

Parameters
A- The first IRInstructionCandidate, operand values, and current operand mappings to compare.
B- The second IRInstructionCandidate, operand values, and current operand mappings to compare.
Returns
true if the IRSimilarityCandidates operands are compatible.

Definition at line 652 of file IRSimilarityIdentifier.cpp.

References A, B, checkNumberingAndReplace(), Idx, and if().

Referenced by compareStructure().

◆ compareStructure() [1/2]

bool IRSimilarityCandidate::compareStructure ( const IRSimilarityCandidate A,
const IRSimilarityCandidate B 
)
static
Parameters
[in]A- The first IRInstructionCandidate to compare.
[in]B- The second IRInstructionCandidate to compare.
Returns
True when every IRInstructionData in A is structurally similar to B.

Definition at line 777 of file IRSimilarityIdentifier.cpp.

References A, B, and compareStructure().

Referenced by compareStructure(), and findCandidateStructures().

◆ compareStructure() [2/2]

bool IRSimilarityCandidate::compareStructure ( const IRSimilarityCandidate A,
const IRSimilarityCandidate B,
DenseMap< unsigned, DenseSet< unsigned > > &  ValueNumberMappingA,
DenseMap< unsigned, DenseSet< unsigned > > &  ValueNumberMappingB 
)
static
Parameters
[in]A- The first IRInstructionCandidate to compare.
[in]B- The second IRInstructionCandidate to compare.
[in,out]ValueNumberMappingA- A mapping of value numbers from candidate A to candidate \B.
[in,out]ValueNumberMappingB- A mapping of value numbers from candidate B to candidate \A.
Returns
True when every IRInstructionData in A is structurally similar to B.

Definition at line 789 of file IRSimilarityIdentifier.cpp.

References A, llvm::any_of(), assert(), B, checkRelativeLocations(), compareAssignmentMapping(), compareCommutativeOperandMapping(), compareNonCommutativeOperandMapping(), llvm::IRSimilarity::isClose(), llvm::ArrayRef< T >::size(), llvm::SmallVectorBase< Size_T >::size(), and llvm::zip().

◆ createCanonicalMappingFor()

void IRSimilarityCandidate::createCanonicalMappingFor ( IRSimilarityCandidate CurrCand)
static

Create a mapping from the value numbering to a different separate set of numbers.

This will serve as a guide for relating one candidate to another. The canonical number gives use the ability identify which global value number in one candidate relates to the global value number in the other.

Parameters
[in,out]CurrCand- The IRSimilarityCandidate to create a canonical numbering for.

Definition at line 1174 of file IRSimilarityIdentifier.cpp.

References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size().

Referenced by findCandidateStructures().

◆ createCanonicalRelationFrom() [1/3]

void IRSimilarityCandidate::createCanonicalRelationFrom ( IRSimilarityCandidate SourceCand,
DenseMap< unsigned, DenseSet< unsigned > > &  ToSourceMapping,
DenseMap< unsigned, DenseSet< unsigned > > &  FromSourceMapping 
)

Create a mapping for the value numbering of the calling IRSimilarityCandidate, to a different separate set of numbers, based on the canonical ordering in SourceCand.

These are defined based on the found mappings in ToSourceMapping and FromSourceMapping. Both of these relationships should have the same information, just in opposite directions.

Parameters
[in,out]SourceCand- The IRSimilarityCandidate to create a canonical numbering from.
ToSourceMapping- The mapping of value numbers from this candidate to SourceCand.
FromSourceMapping- The mapping of value numbers from SoureCand to this candidate.

Definition at line 1009 of file IRSimilarityIdentifier.cpp.

References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::contains(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), fromCanonicalNum(), fromGVN(), frontInstruction(), getBasicBlocks(), getCanonicalNum(), getGVN(), llvm::BasicBlock::getParent(), getStartBB(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size().

◆ createCanonicalRelationFrom() [2/3]

void llvm::IRSimilarity::IRSimilarityCandidate::createCanonicalRelationFrom ( IRSimilarityCandidate SourceCand,
DenseMap< unsigned, unsigned > &  OneToOne,
DenseMap< unsigned, DenseSet< unsigned > > &  ToSourceMapping,
DenseMap< unsigned, DenseSet< unsigned > > &  FromSourceMapping 
)

Create a mapping for the value numbering of the calling IRSimilarityCandidate, to a different separate set of numbers, based on the canonical ordering in SourceCand.

These are defined based on the found mappings in ToSourceMapping and FromSourceMapping. Both of these relationships should have the same information, just in opposite directions. Uses the OneToOne mapping from target candidate to SourceCand GVNs to determine the mapping first for values with multiple mappings. This mapping is created by the ordering of operands in the instruction they are first seen in the candidates.

Parameters
[in,out]SourceCand- The IRSimilarityCandidate to create a canonical numbering from.
[in,out]OneToOne- A mapping of value numbers from candidate A to candidate \B using the structure of the original instructions.
ToSourceMapping- The mapping of value numbers from this candidate to SourceCand.
FromSourceMapping- The mapping of value numbers from SoureCand to this candidate.

◆ createCanonicalRelationFrom() [3/3]

void IRSimilarityCandidate::createCanonicalRelationFrom ( IRSimilarityCandidate SourceCand,
IRSimilarityCandidate SourceCandLarge,
IRSimilarityCandidate TargetCandLarge 
)

Create a mapping for the value numbering of the calling IRSimilarityCandidate, to a different separate set of numbers, based on the canonical ordering in SourceCand.

These are defined based on the canonical mapping defined between SoureCandLarge and TargetCandLarge. These IRSimilarityCandidates are already structurally similar, and fully encapsulate the IRSimilarityCandidates in question. These are used as a "bridge" from the SourceCand to the target.

Parameters
[in,out]SourceCand- The IRSimilarityCandidate to create a canonical numbering from.
SoureCandLarge- The IRSimilarityCandidate fully containing SourceCand.
TargetCandLarge- The IRSimilarityCandidate fully containing this Candidate.

Definition at line 1104 of file IRSimilarityIdentifier.cpp.

References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::empty(), fromCanonicalNum(), fromGVN(), getCanonicalNum(), getGVN(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert().

◆ end()

iterator llvm::IRSimilarity::IRSimilarityCandidate::end ( ) const
inline

Definition at line 1013 of file IRSimilarityIdentifier.h.

References back().

Referenced by llvm::OutlinableRegion::splitCandidate().

◆ fromCanonicalNum()

std::optional< unsigned > llvm::IRSimilarity::IRSimilarityCandidate::fromCanonicalNum ( unsigned  N)
inline

Find the global value number from the canonical number N stored in the candidate.

Parameters
N- The canonical number to find the global vlaue number for.
Returns
An optional containing the value, and std::nullopt if it could not be found.

Definition at line 997 of file IRSimilarityIdentifier.h.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and N.

Referenced by createCanonicalRelationFrom().

◆ fromGVN()

std::optional< Value * > llvm::IRSimilarity::IRSimilarityCandidate::fromGVN ( unsigned  Num)
inline

Finds the Value associate with Num if it exists.

Parameters
[in]Num- the number to find.
Returns
The Value associated with the number.
std::nullopt if not present.

Definition at line 970 of file IRSimilarityIdentifier.h.

References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find().

Referenced by createCanonicalRelationFrom().

◆ front()

IRInstructionData * llvm::IRSimilarity::IRSimilarityCandidate::front ( ) const
inline
Returns
The first IRInstructionData.

Definition at line 937 of file IRSimilarityIdentifier.h.

Referenced by begin().

◆ frontInstruction()

Instruction * llvm::IRSimilarity::IRSimilarityCandidate::frontInstruction ( )
inline
Returns
The first Instruction.

Definition at line 942 of file IRSimilarityIdentifier.h.

References llvm::IRSimilarity::IRInstructionData::Inst.

Referenced by createCanonicalRelationFrom().

◆ getBasicBlocks() [1/2]

void llvm::IRSimilarity::IRSimilarityCandidate::getBasicBlocks ( DenseSet< BasicBlock * > &  BBSet) const
inline

◆ getBasicBlocks() [2/2]

void llvm::IRSimilarity::IRSimilarityCandidate::getBasicBlocks ( DenseSet< BasicBlock * > &  BBSet,
SmallVector< BasicBlock * > &  BBList 
) const
inline
Parameters
[in,out]BBSet- The set to track the basic blocks.
[in,out]BBList- A list in order of use to track the basic blocks.

Definition at line 907 of file IRSimilarityIdentifier.h.

References llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().

◆ getCanonicalNum()

std::optional< unsigned > llvm::IRSimilarity::IRSimilarityCandidate::getCanonicalNum ( unsigned  N)
inline

Find the canonical number from the global value number N stored in the candidate.

Parameters
N- The global value number to find the canonical number for.
Returns
An optional containing the value, and std::nullopt if it could not be found.

Definition at line 984 of file IRSimilarityIdentifier.h.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and N.

Referenced by createCanonicalRelationFrom(), llvm::OutlinableRegion::findCorrespondingValueIn(), and getGVNForPHINode().

◆ getEndBB()

BasicBlock * llvm::IRSimilarity::IRSimilarityCandidate::getEndBB ( )
inline

◆ getEndIdx()

unsigned llvm::IRSimilarity::IRSimilarityCandidate::getEndIdx ( ) const
inline
Returns
the end index of this IRSimilarityCandidate.

Definition at line 934 of file IRSimilarityIdentifier.h.

Referenced by CheckLargerCands().

◆ getFunction()

Function * llvm::IRSimilarity::IRSimilarityCandidate::getFunction ( )
inline
Returns
The Function that the IRSimilarityCandidate is located in.

Definition at line 952 of file IRSimilarityIdentifier.h.

References llvm::BasicBlock::getParent(), and getStartBB().

◆ getGVN()

std::optional< unsigned > llvm::IRSimilarity::IRSimilarityCandidate::getGVN ( Value V)
inline

Finds the positive number associated with V if it has been mapped.

Parameters
[in]V- the Value to find.
Returns
The positive number corresponding to the value.
std::nullopt if not present.

Definition at line 958 of file IRSimilarityIdentifier.h.

References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find().

Referenced by createCanonicalRelationFrom(), llvm::OutlinableRegion::findCorrespondingValueIn(), and getGVNForPHINode().

◆ getLength()

unsigned llvm::IRSimilarity::IRSimilarityCandidate::getLength ( ) const
inline
Returns
the number of instructions in this Candidate.

Definition at line 928 of file IRSimilarityIdentifier.h.

◆ getStartBB()

BasicBlock * llvm::IRSimilarity::IRSimilarityCandidate::getStartBB ( )
inline

◆ getStartIdx()

unsigned llvm::IRSimilarity::IRSimilarityCandidate::getStartIdx ( ) const
inline
Returns
the start index of this IRSimilarityCandidate.

Definition at line 931 of file IRSimilarityIdentifier.h.

Referenced by CheckLargerCands(), and operator<().

◆ isSimilar()

bool IRSimilarityCandidate::isSimilar ( const IRSimilarityCandidate A,
const IRSimilarityCandidate B 
)
static
Parameters
A- The first IRInstructionCandidate to compare.
B- The second IRInstructionCandidate to compare.
Returns
True when every IRInstructionData in A is similar to every IRInstructionData in B.

Definition at line 496 of file IRSimilarityIdentifier.cpp.

References A, llvm::all_of(), B, llvm::IRSimilarity::isClose(), llvm::make_range(), and llvm::zip().

◆ operator<()

bool llvm::IRSimilarity::IRSimilarityCandidate::operator< ( const IRSimilarityCandidate RHS) const
inline
Parameters
RHS-The IRSimilarityCandidate to compare against
Returns
true if the IRSimilarityCandidate is occurs after the IRSimilarityCandidate in the program.

Definition at line 1007 of file IRSimilarityIdentifier.h.

References getStartIdx(), and RHS.

◆ overlap()

bool IRSimilarityCandidate::overlap ( const IRSimilarityCandidate A,
const IRSimilarityCandidate B 
)
static

Compare the start and end indices of the two IRSimilarityCandidates for whether they overlap.

If the start instruction of one IRSimilarityCandidate is less than the end instruction of the other, and the start instruction of one is greater than the start instruction of the other, they overlap.

Returns
true if the IRSimilarityCandidates do not have overlapping instructions.

Definition at line 899 of file IRSimilarityIdentifier.cpp.

References A, B, X, and Y.


The documentation for this class was generated from the following files: