[llvm] [IRSim] Fix overlap() (PR #92988)
Justin Fargnoli via llvm-commits
llvm-commits at lists.llvm.org
Tue May 21 20:40:48 PDT 2024
https://github.com/justinfargnoli created https://github.com/llvm/llvm-project/pull/92988
Ensure that the end of `A` comes before the beginning of `B`. Otherwise, `A` and `B` do not overlap.
>From d4db4b15adf2aaa7f61532948a79d5702b88a452 Mon Sep 17 00:00:00 2001
From: Justin Fargnoli <justinfargnoli at gmail.com>
Date: Tue, 21 May 2024 20:38:52 -0700
Subject: [PATCH] [IRSim] Fix overlap()
---
llvm/lib/Analysis/IRSimilarityIdentifier.cpp | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
index ebe22f5c35d18..3c32682bb3de6 100644
--- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -898,15 +898,7 @@ bool IRSimilarityCandidate::compareStructure(
bool IRSimilarityCandidate::overlap(const IRSimilarityCandidate &A,
const IRSimilarityCandidate &B) {
- auto DoesOverlap = [](const IRSimilarityCandidate &X,
- const IRSimilarityCandidate &Y) {
- // Check:
- // XXXXXX X starts before Y ends
- // YYYYYYY Y starts after X starts
- return X.StartIdx <= Y.getEndIdx() && Y.StartIdx >= X.StartIdx;
- };
-
- return DoesOverlap(A, B) || DoesOverlap(B, A);
+ return A.StartIdx <= B.getEndIdx() && B.StartIdx <= A.getEndIdx();
}
void IRSimilarityIdentifier::populateMapper(
More information about the llvm-commits
mailing list