Skip to content

Commit c4d927c

Browse files
committed
Revert "[SLP]Correctly schedule standalone schedule data, which is part of tree entry"
This reverts commit 57cae2b to fix a buildbot https://lab.llvm.org/buildbot/#/builders/169/builds/14776
1 parent 6fc32e9 commit c4d927c

File tree

3 files changed

+29
-195
lines changed

3 files changed

+29
-195
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5574,22 +5574,7 @@ class BoUpSLP {
55745574
if (auto *SD = dyn_cast<ScheduleData>(Data)) {
55755575
SD->setScheduled(/*Scheduled=*/true);
55765576
LLVM_DEBUG(dbgs() << "SLP: schedule " << *SD << "\n");
5577-
SmallVector<ScheduleBundle> PseudoBundles;
5578-
SmallVector<ScheduleBundle *> Bundles;
5579-
Instruction *In = SD->getInst();
5580-
if (R.isVectorized(In)) {
5581-
ArrayRef<TreeEntry *> Entries = R.getTreeEntries(In);
5582-
for (TreeEntry *TE : Entries) {
5583-
if (!isa<ExtractValueInst, ExtractElementInst, CallBase>(In) &&
5584-
In->getNumOperands() != TE->getNumOperands())
5585-
continue;
5586-
ScheduleBundle &Bundle = PseudoBundles.emplace_back();
5587-
Bundle.setTreeEntry(TE);
5588-
Bundle.add(SD);
5589-
Bundles.push_back(&Bundle);
5590-
}
5591-
}
5592-
ProcessBundleMember(SD, Bundles);
5577+
ProcessBundleMember(SD, {});
55935578
} else {
55945579
ScheduleBundle &Bundle = *cast<ScheduleBundle>(Data);
55955580
Bundle.setScheduled(/*Scheduled=*/true);
@@ -20868,7 +20853,23 @@ BoUpSLP::BlockScheduling::tryScheduleBundle(ArrayRef<Value *> VL, BoUpSLP *SLP,
2086820853
for (Value *V : VL) {
2086920854
if (S.isNonSchedulable(V))
2087020855
continue;
20871-
if (!extendSchedulingRegion(V, S)) {
20856+
// For copybales with parent nodes, which do not need to be scheduled, the
20857+
// parents should not be commutative, otherwise may incorrectly handle deps
20858+
// because of the potential reordering of commutative operations.
20859+
if ((S.isCopyableElement(V) && EI.UserTE && !EI.UserTE->isGather() &&
20860+
EI.UserTE->hasState() && EI.UserTE->doesNotNeedToSchedule() &&
20861+
any_of(EI.UserTE->Scalars,
20862+
[&](Value *V) {
20863+
if (isa<PoisonValue>(V))
20864+
return false;
20865+
auto *I = dyn_cast<Instruction>(V);
20866+
return isCommutative(
20867+
(I && EI.UserTE->isAltShuffle())
20868+
? EI.UserTE->getMatchingMainOpOrAltOp(I)
20869+
: EI.UserTE->getMainOp(),
20870+
V);
20871+
})) ||
20872+
!extendSchedulingRegion(V, S)) {
2087220873
// If the scheduling region got new instructions at the lower end (or it
2087320874
// is a new region for the first bundle). This makes it necessary to
2087420875
// recalculate all dependencies.

llvm/test/Transforms/SLPVectorizer/X86/copyable-with-non-scheduled-parent-node.ll

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,20 @@
44
define i64 @test(ptr %a) {
55
; CHECK-LABEL: define i64 @test(
66
; CHECK-SAME: ptr [[A:%.*]]) #[[ATTR0:[0-9]+]] {
7+
; CHECK-NEXT: [[TMP1:%.*]] = add i64 0, 0
78
; CHECK-NEXT: [[TMP2:%.*]] = load i64, ptr [[A]], align 4
8-
; CHECK-NEXT: [[TMP7:%.*]] = insertelement <4 x i64> <i64 poison, i64 0, i64 0, i64 0>, i64 [[TMP2]], i32 0
9-
; CHECK-NEXT: [[TMP3:%.*]] = add <4 x i64> zeroinitializer, [[TMP7]]
10-
; CHECK-NEXT: [[TMP4:%.*]] = add <4 x i64> <i64 0, i64 0, i64 0, i64 1>, [[TMP3]]
11-
; CHECK-NEXT: [[TMP5:%.*]] = shufflevector <4 x i64> [[TMP4]], <4 x i64> poison, <6 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison>
12-
; CHECK-NEXT: [[TMP6:%.*]] = shufflevector <6 x i64> [[TMP5]], <6 x i64> <i64 0, i64 0, i64 undef, i64 undef, i64 undef, i64 undef>, <6 x i32> <i32 0, i32 1, i32 2, i32 3, i32 6, i32 7>
9+
; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[TMP2]], 0
10+
; CHECK-NEXT: [[TMP4:%.*]] = add i64 1, [[TMP1]]
11+
; CHECK-NEXT: [[TMP5:%.*]] = ashr i64 0, 1
12+
; CHECK-NEXT: [[TMP6:%.*]] = ashr i64 0, 0
1313
; CHECK-NEXT: br label %[[BB7:.*]]
1414
; CHECK: [[BB7]]:
15-
; CHECK-NEXT: [[TMP8:%.*]] = phi <6 x i64> [ [[TMP6]], [[TMP0:%.*]] ]
15+
; CHECK-NEXT: [[TMP8:%.*]] = phi i64 [ [[TMP3]], [[TMP0:%.*]] ]
16+
; CHECK-NEXT: [[TMP9:%.*]] = phi i64 [ 0, [[TMP0]] ]
17+
; CHECK-NEXT: [[TMP10:%.*]] = phi i64 [ [[TMP6]], [[TMP0]] ]
18+
; CHECK-NEXT: [[TMP11:%.*]] = phi i64 [ [[TMP5]], [[TMP0]] ]
19+
; CHECK-NEXT: [[TMP12:%.*]] = phi i64 [ 0, [[TMP0]] ]
20+
; CHECK-NEXT: [[TMP13:%.*]] = phi i64 [ [[TMP4]], [[TMP0]] ]
1621
; CHECK-NEXT: ret i64 0
1722
;
1823
%1 = add i64 0, 0

llvm/test/Transforms/SLPVectorizer/X86/parent-node-non-schedulable.ll

Lines changed: 0 additions & 172 deletions
This file was deleted.

0 commit comments

Comments
 (0)