[llvm] [SLP] Use poison instead of undef in reorderScalars() (PR #96619)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 03:53:09 PDT 2024


https://github.com/nikic created https://github.com/llvm/llvm-project/pull/96619

-1 mask elements are specified to return poison rather than undef nowadays , so update the reorderScalars() implementation to match.

This doesn't cause any actual test changes. Putting up a PR for this just in case there is some SLP-specific divergence I'm not aware of.

>From ab2855d6b0584d7cde3b29faf89384388d5a8174 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Tue, 25 Jun 2024 12:51:05 +0200
Subject: [PATCH] [SLP] Use poison instead of undef in reorderScalars()

-1 mask elements are specified to return poison rather than undef
nowadays , so update the reorderScalars() implementation to match.

Putting up a PR for this just in case there is some SLP-specific
divergence I'm not aware of.
---
 llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 501f6afd60607..494db0493daca 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -999,7 +999,7 @@ static void reorderScalars(SmallVectorImpl<Value *> &Scalars,
                            ArrayRef<int> Mask) {
   assert(!Mask.empty() && "Expected non-empty mask.");
   SmallVector<Value *> Prev(Scalars.size(),
-                            UndefValue::get(Scalars.front()->getType()));
+                            PoisonValue::get(Scalars.front()->getType()));
   Prev.swap(Scalars);
   for (unsigned I = 0, E = Prev.size(); I < E; ++I)
     if (Mask[I] != PoisonMaskElem)



More information about the llvm-commits mailing list