[llvm] f9c806a - [SLP][NFC]Make isFirstInsertElement a weak strict ordering comparator.
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Tue May 24 06:08:17 PDT 2022
Author: Alexey Bataev
Date: 2022-05-24T06:02:42-07:00
New Revision: f9c806ae5c53c990a935c46ba351cdcfb1271c58
URL: https://github.com/llvm/llvm-project/commit/f9c806ae5c53c990a935c46ba351cdcfb1271c58
DIFF: https://github.com/llvm/llvm-project/commit/f9c806ae5c53c990a935c46ba351cdcfb1271c58.diff
LOG: [SLP][NFC]Make isFirstInsertElement a weak strict ordering comparator.
To be used correctly in a sort-like function, isFirstInsertElement
function must follow weak strict ordering rule, i.e.
isFirstInsertElement(IE1, IE1) should return false.
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index beb54dc7822ca..a8de0bffe8d52 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -6659,6 +6659,8 @@ static bool areTwoInsertFromSameBuildVector(InsertElementInst *VU,
/// buildvector sequence.
static bool isFirstInsertElement(const InsertElementInst *IE1,
const InsertElementInst *IE2) {
+ if (IE1 == IE2)
+ return false;
const auto *I1 = IE1;
const auto *I2 = IE2;
const InsertElementInst *PrevI1;
More information about the llvm-commits
mailing list