[PATCH] D149548: [IR] Update to use new shufflevector semantics

Manuel Brito via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 30 06:52:21 PDT 2023


ManuelJBrito created this revision.
ManuelJBrito added reviewers: nlopes, nikic, RKSimon.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
ManuelJBrito requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Update to use new semantics added in D148637 <https://reviews.llvm.org/D148637> .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149548

Files:
  llvm/lib/IR/ConstantFold.cpp
  llvm/lib/IR/Instructions.cpp
  llvm/test/Transforms/InstCombine/shufflevec-constant.ll


Index: llvm/test/Transforms/InstCombine/shufflevec-constant.ll
===================================================================
--- llvm/test/Transforms/InstCombine/shufflevec-constant.ll
+++ llvm/test/Transforms/InstCombine/shufflevec-constant.ll
@@ -18,7 +18,7 @@
 
 define <4 x i1> @shuffle_undef_fixed() {
 ; CHECK-LABEL: @shuffle_undef_fixed(
-; CHECK-NEXT:    ret <4 x i1> undef
+; CHECK-NEXT:    ret <4 x i1> poison
 ;
   %S = shufflevector <4 x i1> zeroinitializer, <4 x i1> zeroinitializer, <4 x i32> undef
   ret <4 x i1> %S
@@ -26,7 +26,7 @@
 
 define <vscale x 4 x i1> @suffle_undef_scalable() {
 ; CHECK-LABEL: @suffle_undef_scalable(
-; CHECK-NEXT:    ret <vscale x 4 x i1> undef
+; CHECK-NEXT:    ret <vscale x 4 x i1> poison
 ;
   %S = shufflevector <vscale x 4 x i1> zeroinitializer, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x i32> undef
   ret <vscale x 4 x i1> %S
Index: llvm/lib/IR/Instructions.cpp
===================================================================
--- llvm/lib/IR/Instructions.cpp
+++ llvm/lib/IR/Instructions.cpp
@@ -2290,7 +2290,7 @@
   SmallVector<Constant *, 16> MaskConst;
   for (int Elem : Mask) {
     if (Elem == PoisonMaskElem)
-      MaskConst.push_back(UndefValue::get(Int32Ty));
+      MaskConst.push_back(PoisonValue::get(Int32Ty));
     else
       MaskConst.push_back(ConstantInt::get(Int32Ty, Elem));
   }
Index: llvm/lib/IR/ConstantFold.cpp
===================================================================
--- llvm/lib/IR/ConstantFold.cpp
+++ llvm/lib/IR/ConstantFold.cpp
@@ -710,9 +710,9 @@
       ElementCount::get(MaskNumElts, isa<ScalableVectorType>(V1VTy));
   Type *EltTy = V1VTy->getElementType();
 
-  // Undefined shuffle mask -> undefined value.
+  // Poison shuffle mask -> poison value.
   if (all_of(Mask, [](int Elt) { return Elt == PoisonMaskElem; })) {
-    return UndefValue::get(VectorType::get(EltTy, MaskEltCount));
+    return PoisonValue::get(VectorType::get(EltTy, MaskEltCount));
   }
 
   // If the mask is all zeros this is a splat, no need to go through all


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149548.518303.patch
Type: text/x-patch
Size: 2054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230430/98551d44/attachment.bin>


More information about the llvm-commits mailing list