diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -710,9 +710,9 @@ ElementCount::get(MaskNumElts, isa(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 diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -2290,7 +2290,7 @@ SmallVector 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)); } diff --git a/llvm/test/Transforms/InstCombine/shufflevec-constant.ll b/llvm/test/Transforms/InstCombine/shufflevec-constant.ll --- a/llvm/test/Transforms/InstCombine/shufflevec-constant.ll +++ b/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 @suffle_undef_scalable() { ; CHECK-LABEL: @suffle_undef_scalable( -; CHECK-NEXT: ret undef +; CHECK-NEXT: ret poison ; %S = shufflevector zeroinitializer, zeroinitializer, undef ret %S