Author: ManuelJBrito Date: 2023-06-13T17:12:04+01:00 New Revision: 22f5dc7501b5eb97e406fd6c5e44048bb712ecc3
URL: https://github.com/llvm/llvm-project/commit/22f5dc7501b5eb97e406fd6c5e44048bb712ecc3 DIFF: https://github.com/llvm/llvm-project/commit/22f5dc7501b5eb97e406fd6c5e44048bb712ecc3.diff LOG: [IR] Update to use new shufflevector semantics Update to use new shufflevector semantics for undefined values in the mask Differential Revision: https://reviews.llvm.org/D149548 Added: Modified: clang/test/CodeGen/SystemZ/builtins-systemz-zvector-constrained.c clang/test/CodeGen/SystemZ/builtins-systemz-zvector.c clang/test/CodeGen/SystemZ/builtins-systemz-zvector2-constrained.c clang/test/CodeGen/SystemZ/builtins-systemz-zvector2.c llvm/lib/IR/ConstantFold.cpp llvm/lib/IR/Instructions.cpp llvm/test/Transforms/InstCombine/shufflevec-constant.ll Removed: ################################################################################ diff --git a/clang/test/CodeGen/SystemZ/builtins-systemz-zvector-constrained.c b/clang/test/CodeGen/SystemZ/builtins-systemz-zvector-constrained.c index 9a477e5335961..07d6469d18664 100644 --- a/clang/test/CodeGen/SystemZ/builtins-systemz-zvector-constrained.c +++ b/clang/test/CodeGen/SystemZ/builtins-systemz-zvector-constrained.c @@ -37,7 +37,7 @@ void test_core(void) { // CHECK-ASM: vlvgg vd = vec_promote(d, idx); - // CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <2 x double> poison, double %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgg vd = vec_insert_and_zero(cptrd); diff --git a/clang/test/CodeGen/SystemZ/builtins-systemz-zvector.c b/clang/test/CodeGen/SystemZ/builtins-systemz-zvector.c index 0450e2e1b7152..44f8cbe2cc017 100644 --- a/clang/test/CodeGen/SystemZ/builtins-systemz-zvector.c +++ b/clang/test/CodeGen/SystemZ/builtins-systemz-zvector.c @@ -166,31 +166,31 @@ void test_core(void) { // CHECK-ASM: vlvgg vsc = vec_promote(sc, idx); - // CHECK: insertelement <16 x i8> undef, i8 %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <16 x i8> poison, i8 %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgb vuc = vec_promote(uc, idx); - // CHECK: insertelement <16 x i8> undef, i8 %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <16 x i8> poison, i8 %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgb vss = vec_promote(ss, idx); - // CHECK: insertelement <8 x i16> undef, i16 %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <8 x i16> poison, i16 %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgh vus = vec_promote(us, idx); - // CHECK: insertelement <8 x i16> undef, i16 %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <8 x i16> poison, i16 %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgh vsi = vec_promote(si, idx); - // CHECK: insertelement <4 x i32> undef, i32 %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <4 x i32> poison, i32 %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgf vui = vec_promote(ui, idx); - // CHECK: insertelement <4 x i32> undef, i32 %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <4 x i32> poison, i32 %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgf vsl = vec_promote(sl, idx); - // CHECK: insertelement <2 x i64> undef, i64 %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <2 x i64> poison, i64 %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgg vul = vec_promote(ul, idx); - // CHECK: insertelement <2 x i64> undef, i64 %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <2 x i64> poison, i64 %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgg vd = vec_promote(d, idx); - // CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <2 x double> poison, double %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgg vsc = vec_insert_and_zero(cptrsc); diff --git a/clang/test/CodeGen/SystemZ/builtins-systemz-zvector2-constrained.c b/clang/test/CodeGen/SystemZ/builtins-systemz-zvector2-constrained.c index 2aad22b6d67bf..112bbac3394e9 100644 --- a/clang/test/CodeGen/SystemZ/builtins-systemz-zvector2-constrained.c +++ b/clang/test/CodeGen/SystemZ/builtins-systemz-zvector2-constrained.c @@ -70,10 +70,10 @@ void test_core(void) { // CHECK-ASM: vlvgg vf = vec_promote(f, idx); - // CHECK: insertelement <4 x float> undef, float %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <4 x float> poison, float %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgf vd = vec_promote(d, idx); - // CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <2 x double> poison, double %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgg vf = vec_insert_and_zero(cptrf); diff --git a/clang/test/CodeGen/SystemZ/builtins-systemz-zvector2.c b/clang/test/CodeGen/SystemZ/builtins-systemz-zvector2.c index 584c76adbe817..416ca0ddd1b4f 100644 --- a/clang/test/CodeGen/SystemZ/builtins-systemz-zvector2.c +++ b/clang/test/CodeGen/SystemZ/builtins-systemz-zvector2.c @@ -102,10 +102,10 @@ void test_core(void) { // CHECK-ASM: vlvgg vf = vec_promote(f, idx); - // CHECK: insertelement <4 x float> undef, float %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <4 x float> poison, float %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgf vd = vec_promote(d, idx); - // CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 %{{.*}} + // CHECK: insertelement <2 x double> poison, double %{{.*}}, i32 %{{.*}} // CHECK-ASM: vlvgg vf = vec_insert_and_zero(cptrf); diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index 101e1de31b2b1..fda8bc11bffaa 100644 --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -710,9 +710,9 @@ Constant *llvm::ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2, 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 diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 3983fd8ed7ff8..f21767165f308 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -2290,7 +2290,7 @@ Constant *ShuffleVectorInst::convertShuffleMaskForBitcode(ArrayRef<int> Mask, 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)); } diff --git a/llvm/test/Transforms/InstCombine/shufflevec-constant.ll b/llvm/test/Transforms/InstCombine/shufflevec-constant.ll index 9b05185e868f1..7d33473aecca5 100644 --- a/llvm/test/Transforms/InstCombine/shufflevec-constant.ll +++ b/llvm/test/Transforms/InstCombine/shufflevec-constant.ll @@ -18,7 +18,7 @@ define <4 x float> @__inff4() nounwind readnone { 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 <4 x i1> @shuffle_undef_fixed() { 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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits