[llvm] f7cc224 - Revert "[libclc] Refactor build system to allow in-tree builds (#87622)"
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 11 11:10:48 PDT 2024
Author: Alexey Bataev
Date: 2024-04-11T11:08:47-07:00
New Revision: f7cc224044a5121191b7d96825988bd954ce49e2
URL: https://github.com/llvm/llvm-project/commit/f7cc224044a5121191b7d96825988bd954ce49e2
DIFF: https://github.com/llvm/llvm-project/commit/f7cc224044a5121191b7d96825988bd954ce49e2.diff
LOG: Revert "[libclc] Refactor build system to allow in-tree builds (#87622)"
This reverts commit 9029e6ebdfd98a58b5c5646fd534c6c849148cda, which was
committed by mistake with the wrong message and fails https://lab.llvm.org/buildbot/#/builders/221/builds/21958.
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/X86/store-abs-minbitwidth.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 55dc0867e2ea9b..2995cb8435f769 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -305,32 +305,7 @@ static bool isCommutative(Instruction *I) {
if (auto *Cmp = dyn_cast<CmpInst>(I))
return Cmp->isCommutative();
if (auto *BO = dyn_cast<BinaryOperator>(I))
- return BO->isCommutative() ||
- (BO->getOpcode() == Instruction::Sub &&
- !BO->hasNUsesOrMore(UsesLimit) &&
- all_of(
- BO->uses(),
- [](const Use &U) {
- // Commutative, if icmp eq/ne sub, 0
- ICmpInst::Predicate Pred;
- if (match(U.getUser(),
- m_ICmp(Pred, m_Specific(U.get()), m_Zero())) &&
- (Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_NE))
- return true;
- // Commutative, if abs(sub nsw, true) or abs(sub, false).
- ConstantInt *Flag;
- return match(U.getUser(),
- m_Intrinsic<Intrinsic::abs>(
- m_Specific(U.get()), m_ConstantInt(Flag))) &&
- (!cast<Instruction>(U.get())->hasNoSignedWrap() ||
- Flag->isOne());
- })) ||
- (BO->getOpcode() == Instruction::FSub &&
- !BO->hasNUsesOrMore(UsesLimit) &&
- all_of(BO->uses(), [](const Use &U) {
- return match(U.getUser(),
- m_Intrinsic<Intrinsic::fabs>(m_Specific(U.get())));
- }));
+ return BO->isCommutative();
return I->isCommutative();
}
@@ -6863,7 +6838,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
// Sort operands of the instructions so that each side is more likely to
// have the same opcode.
- if (isa<BinaryOperator>(VL0) && isCommutative(VL0)) {
+ if (isa<BinaryOperator>(VL0) && VL0->isCommutative()) {
ValueList Left, Right;
reorderInputsAccordingToOpcode(VL, Left, Right, *this);
TE->setOperand(0, Left);
@@ -12591,15 +12566,8 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E, bool PostponedPHIs) {
static_cast<Instruction::BinaryOps>(E->getOpcode()), LHS,
RHS);
propagateIRFlags(V, E->Scalars, VL0, It == MinBWs.end());
- if (auto *I = dyn_cast<Instruction>(V)) {
+ if (auto *I = dyn_cast<Instruction>(V))
V = propagateMetadata(I, E->Scalars);
- // Drop nuw flags for abs(sub(commutative), true).
- if (!MinBWs.contains(E) && ShuffleOrOp == Instruction::Sub &&
- any_of(E->Scalars, [](Value *V) {
- return isCommutative(cast<Instruction>(V));
- }))
- I->setHasNoUnsignedWrap(/*b=*/false);
- }
V = FinalShuffle(V, E, VecTy);
@@ -12925,19 +12893,6 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E, bool PostponedPHIs) {
propagateIRFlags(V0, OpScalars, E->getMainOp(), It == MinBWs.end());
propagateIRFlags(V1, AltScalars, E->getAltOp(), It == MinBWs.end());
- auto DropNuwFlag = [&](Value *Vec, unsigned Opcode) {
- // Drop nuw flags for abs(sub(commutative), true).
- if (auto *I = dyn_cast<Instruction>(Vec);
- I && Opcode == Instruction::Sub && !MinBWs.contains(E) &&
- any_of(E->Scalars, [](Value *V) {
- auto *I = cast<Instruction>(V);
- return I->getOpcode() == Instruction::Sub &&
- isCommutative(cast<Instruction>(V));
- }))
- I->setHasNoUnsignedWrap(/*b=*/false);
- };
- DropNuwFlag(V0, E->getOpcode());
- DropNuwFlag(V1, E->getAltOpcode());
Value *V = Builder.CreateShuffleVector(V0, V1, Mask);
if (auto *I = dyn_cast<Instruction>(V)) {
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/store-abs-minbitwidth.ll b/llvm/test/Transforms/SLPVectorizer/X86/store-abs-minbitwidth.ll
index 64bfb242752c10..df7312e3d2b56c 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/store-abs-minbitwidth.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/store-abs-minbitwidth.ll
@@ -4,9 +4,19 @@
define i32 @test(ptr noalias %in, ptr noalias %inn, ptr %out) {
; CHECK-LABEL: @test(
-; CHECK-NEXT: [[TMP7:%.*]] = load <4 x i8>, ptr [[IN:%.*]], align 1
-; CHECK-NEXT: [[TMP11:%.*]] = load <4 x i8>, ptr [[INN:%.*]], align 1
+; CHECK-NEXT: [[TMP1:%.*]] = load <2 x i8>, ptr [[IN:%.*]], align 1
+; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i8, ptr [[IN]], i64 2
+; CHECK-NEXT: [[TMP2:%.*]] = load <2 x i8>, ptr [[GEP_2]], align 1
+; CHECK-NEXT: [[TMP3:%.*]] = load <2 x i8>, ptr [[INN:%.*]], align 1
+; CHECK-NEXT: [[GEP_5:%.*]] = getelementptr inbounds i8, ptr [[INN]], i64 2
+; CHECK-NEXT: [[TMP4:%.*]] = load <2 x i8>, ptr [[GEP_5]], align 1
+; CHECK-NEXT: [[TMP5:%.*]] = shufflevector <2 x i8> [[TMP3]], <2 x i8> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
+; CHECK-NEXT: [[TMP6:%.*]] = shufflevector <2 x i8> [[TMP2]], <2 x i8> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
+; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <4 x i8> [[TMP5]], <4 x i8> [[TMP6]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
; CHECK-NEXT: [[TMP8:%.*]] = sext <4 x i8> [[TMP7]] to <4 x i16>
+; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <2 x i8> [[TMP1]], <2 x i8> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
+; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <2 x i8> [[TMP4]], <2 x i8> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
+; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <4 x i8> [[TMP9]], <4 x i8> [[TMP10]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
; CHECK-NEXT: [[TMP12:%.*]] = sext <4 x i8> [[TMP11]] to <4 x i16>
; CHECK-NEXT: [[TMP13:%.*]] = sub <4 x i16> [[TMP12]], [[TMP8]]
; CHECK-NEXT: [[TMP15:%.*]] = call <4 x i16> @llvm.abs.v4i16(<4 x i16> [[TMP13]], i1 false)
More information about the llvm-commits
mailing list