[llvm] Revert "[SLP]Do not gather node, if the instruction, that does not require" (PR #67386)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 25 17:33:47 PDT 2023
https://github.com/alexfh created https://github.com/llvm/llvm-project/pull/67386
This reverts commit 77053421228edd12a3ba73d4eebd970fcdd3b2c0, which introduces a
clang crash (test case: https://gcc.godbolt.org/z/zn5n4KWPY).
>From 83704dbd39fb63bcbd407efcdc6dbc7497c80876 Mon Sep 17 00:00:00 2001
From: Alexander Kornienko <alexfh at google.com>
Date: Tue, 26 Sep 2023 02:13:16 +0200
Subject: [PATCH] Revert "[SLP]Do not gather node, if the instruction, that
does not require"
This reverts commit 77053421228edd12a3ba73d4eebd970fcdd3b2c0, which introduces a
clang crash (test case: https://gcc.godbolt.org/z/zn5n4KWPY).
---
.../Transforms/Vectorize/SLPVectorizer.cpp | 23 ++++++++-----------
.../X86/multi-node-vectorized-insts.ll | 9 ++++----
2 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 4b3cc9e41bbd62d..77362d610a0c839 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -5806,21 +5806,18 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
if (TreeEntry *E = getTreeEntry(S.OpValue)) {
LLVM_DEBUG(dbgs() << "SLP: \tChecking bundle: " << *S.OpValue << ".\n");
if (!E->isSame(VL)) {
- if (!doesNotNeedToBeScheduled(S.OpValue)) {
- LLVM_DEBUG(dbgs() << "SLP: Gathering due to partial overlap.\n");
- if (TryToFindDuplicates(S))
- newTreeEntry(VL, std::nullopt /*not vectorized*/, S, UserTreeIdx,
- ReuseShuffleIndicies);
- return;
- }
- } else {
- // Record the reuse of the tree node. FIXME, currently this is only used
- // to properly draw the graph rather than for the actual vectorization.
- E->UserTreeIndices.push_back(UserTreeIdx);
- LLVM_DEBUG(dbgs() << "SLP: Perfect diamond merge at " << *S.OpValue
- << ".\n");
+ LLVM_DEBUG(dbgs() << "SLP: Gathering due to partial overlap.\n");
+ if (TryToFindDuplicates(S))
+ newTreeEntry(VL, std::nullopt /*not vectorized*/, S, UserTreeIdx,
+ ReuseShuffleIndicies);
return;
}
+ // Record the reuse of the tree node. FIXME, currently this is only used to
+ // properly draw the graph rather than for the actual vectorization.
+ E->UserTreeIndices.push_back(UserTreeIdx);
+ LLVM_DEBUG(dbgs() << "SLP: Perfect diamond merge at " << *S.OpValue
+ << ".\n");
+ return;
}
// Check that none of the instructions in the bundle are already in the tree.
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/multi-node-vectorized-insts.ll b/llvm/test/Transforms/SLPVectorizer/X86/multi-node-vectorized-insts.ll
index 3b54b0a058d0c6b..87292700317ead6 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/multi-node-vectorized-insts.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/multi-node-vectorized-insts.ll
@@ -83,12 +83,13 @@ define void @test2(double %0) {
; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x double> [[TMP2]], <2 x double> poison, <2 x i32> zeroinitializer
; CHECK-NEXT: br label [[TMP4:%.*]]
; CHECK: 4:
-; CHECK-NEXT: [[TMP5:%.*]] = fsub <2 x double> <double 3.000000e+00, double 2.000000e+00>, [[TMP3]]
-; CHECK-NEXT: [[TMP6:%.*]] = fsub <2 x double> <double 3.000000e+00, double 1.000000e+00>, [[TMP3]]
+; CHECK-NEXT: [[TMP5:%.*]] = fsub double 1.000000e+00, [[TMP0]]
+; CHECK-NEXT: [[TMP6:%.*]] = fsub <2 x double> <double 3.000000e+00, double 2.000000e+00>, [[TMP3]]
; CHECK-NEXT: br label [[DOTBACKEDGE:%.*]]
; CHECK: .backedge:
-; CHECK-NEXT: [[TMP7:%.*]] = fmul <2 x double> [[TMP5]], [[TMP6]]
-; CHECK-NEXT: [[TMP8:%.*]] = fcmp olt <2 x double> [[TMP7]], zeroinitializer
+; CHECK-NEXT: [[TMP7:%.*]] = insertelement <2 x double> [[TMP6]], double [[TMP5]], i32 1
+; CHECK-NEXT: [[TMP8:%.*]] = fmul <2 x double> [[TMP6]], [[TMP7]]
+; CHECK-NEXT: [[TMP9:%.*]] = fcmp olt <2 x double> [[TMP8]], zeroinitializer
; CHECK-NEXT: br label [[TMP4]]
;
br label %2
More information about the llvm-commits
mailing list