diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp --- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp @@ -2633,7 +2633,7 @@ if (Inst->getArgOperand(i)->getType() != ST->getElementType(i)) return nullptr; } - Value *Res = UndefValue::get(ExpectedType); + Value *Res = PoisonValue::get(ExpectedType); IRBuilder<> Builder(Inst); for (unsigned i = 0, e = NumElts; i != e; ++i) { Value *L = Inst->getArgOperand(i); diff --git a/llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp b/llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp --- a/llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp +++ b/llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp @@ -548,7 +548,7 @@ Value *UAddResult = Builder.CreateExtractValue(UAdd, 0); Value *UAddOV = Builder.CreateZExt(Builder.CreateExtractValue(UAdd, 1), Builder.getInt8Ty()); - Value *Res = UndefValue::get(RetTy); + Value *Res = PoisonValue::get(RetTy); Res = Builder.CreateInsertValue(Res, UAddOV, 0); return Builder.CreateInsertValue(Res, UAddResult, 1); } diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp --- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -2465,7 +2465,7 @@ if (LeftSize >= ShadowVecSize) { auto *ShadowVecTy = FixedVectorType::get(DFS.PrimitiveShadowTy, ShadowVecSize); - Value *ShadowVec = UndefValue::get(ShadowVecTy); + Value *ShadowVec = PoisonValue::get(ShadowVecTy); for (unsigned I = 0; I != ShadowVecSize; ++I) { ShadowVec = IRB.CreateInsertElement( ShadowVec, PrimitiveShadow, diff --git a/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp b/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp --- a/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp @@ -656,7 +656,7 @@ // shuffle blend with the pass through value. if (isConstantIntVector(Mask)) { unsigned MemIndex = 0; - VResult = UndefValue::get(VecType); + VResult = PoisonValue::get(VecType); SmallVector ShuffleMask(VectorWidth, UndefMaskElem); for (unsigned Idx = 0; Idx < VectorWidth; ++Idx) { Value *InsertElt; diff --git a/llvm/lib/Transforms/Scalar/Scalarizer.cpp b/llvm/lib/Transforms/Scalar/Scalarizer.cpp --- a/llvm/lib/Transforms/Scalar/Scalarizer.cpp +++ b/llvm/lib/Transforms/Scalar/Scalarizer.cpp @@ -848,7 +848,7 @@ if (!ScalarizeVariableInsertExtract) return false; - Value *Res = UndefValue::get(VT->getElementType()); + Value *Res = PoisonValue::get(VT->getElementType()); for (unsigned I = 0; I < NumSrcElems; ++I) { Value *ShouldExtract = Builder.CreateICmpEQ(ExtIdx, ConstantInt::get(ExtIdx->getType(), I), diff --git a/llvm/test/Instrumentation/DataFlowSanitizer/array.ll b/llvm/test/Instrumentation/DataFlowSanitizer/array.ll --- a/llvm/test/Instrumentation/DataFlowSanitizer/array.ll +++ b/llvm/test/Instrumentation/DataFlowSanitizer/array.ll @@ -257,7 +257,7 @@ ; FAST: %[[#R+31]] = or i[[#SBITS]] %[[#R+29]], %[[#R+30]] ; FAST: %[[#R+32]] = extractvalue [17 x i[[#SBITS]]] %[[#R]], 16 ; FAST: %[[#R+33]] = or i[[#SBITS]] %[[#R+31]], %[[#R+32]] - ; FAST: %[[#VREG:]] = insertelement <8 x i[[#SBITS]]> undef, i[[#SBITS]] %[[#R+33]], i32 0 + ; FAST: %[[#VREG:]] = insertelement <8 x i[[#SBITS]]> poison, i[[#SBITS]] %[[#R+33]], i32 0 ; FAST: %[[#VREG+1]] = insertelement <8 x i[[#SBITS]]> %[[#VREG]], i[[#SBITS]] %[[#R+33]], i32 1 ; FAST: %[[#VREG+2]] = insertelement <8 x i[[#SBITS]]> %[[#VREG+1]], i[[#SBITS]] %[[#R+33]], i32 2 ; FAST: %[[#VREG+3]] = insertelement <8 x i[[#SBITS]]> %[[#VREG+2]], i[[#SBITS]] %[[#R+33]], i32 3 diff --git a/llvm/test/Transforms/ScalarizeMaskedMemIntrin/X86/expand-masked-expandload.ll b/llvm/test/Transforms/ScalarizeMaskedMemIntrin/X86/expand-masked-expandload.ll --- a/llvm/test/Transforms/ScalarizeMaskedMemIntrin/X86/expand-masked-expandload.ll +++ b/llvm/test/Transforms/ScalarizeMaskedMemIntrin/X86/expand-masked-expandload.ll @@ -34,7 +34,7 @@ ; CHECK-LABEL: @scalarize_v2i64_ones_mask( ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i64, i64* [[P:%.*]], i32 0 ; CHECK-NEXT: [[LOAD0:%.*]] = load i64, i64* [[TMP1]], align 1 -; CHECK-NEXT: [[RES0:%.*]] = insertelement <2 x i64> undef, i64 [[LOAD0]], i64 0 +; CHECK-NEXT: [[RES0:%.*]] = insertelement <2 x i64> poison, i64 [[LOAD0]], i64 0 ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i64, i64* [[P]], i32 1 ; CHECK-NEXT: [[LOAD1:%.*]] = load i64, i64* [[TMP2]], align 1 ; CHECK-NEXT: [[RES1:%.*]] = insertelement <2 x i64> [[RES0]], i64 [[LOAD1]], i64 1 @@ -58,7 +58,7 @@ ; CHECK-LABEL: @scalarize_v2i64_const_mask( ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i64, i64* [[P:%.*]], i32 0 ; CHECK-NEXT: [[LOAD1:%.*]] = load i64, i64* [[TMP1]], align 1 -; CHECK-NEXT: [[RES1:%.*]] = insertelement <2 x i64> undef, i64 [[LOAD1]], i64 1 +; CHECK-NEXT: [[RES1:%.*]] = insertelement <2 x i64> , i64 [[LOAD1]], i64 1 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x i64> [[RES1]], <2 x i64> [[PASSTHRU:%.*]], <2 x i32> ; CHECK-NEXT: ret <2 x i64> [[TMP2]] ; diff --git a/llvm/test/Transforms/Scalarizer/variable-extractelement.ll b/llvm/test/Transforms/Scalarizer/variable-extractelement.ll --- a/llvm/test/Transforms/Scalarizer/variable-extractelement.ll +++ b/llvm/test/Transforms/Scalarizer/variable-extractelement.ll @@ -10,7 +10,7 @@ ; DEFAULT-LABEL: @f1( ; DEFAULT-NEXT: [[INDEX_IS_0:%.*]] = icmp eq i32 [[INDEX:%.*]], 0 ; DEFAULT-NEXT: [[SRC_I0:%.*]] = extractelement <4 x i32> [[SRC:%.*]], i32 0 -; DEFAULT-NEXT: [[RES_UPTO0:%.*]] = select i1 [[INDEX_IS_0]], i32 [[SRC_I0]], i32 undef +; DEFAULT-NEXT: [[RES_UPTO0:%.*]] = select i1 [[INDEX_IS_0]], i32 [[SRC_I0]], i32 poison ; DEFAULT-NEXT: [[INDEX_IS_1:%.*]] = icmp eq i32 [[INDEX]], 1 ; DEFAULT-NEXT: [[SRC_I1:%.*]] = extractelement <4 x i32> [[SRC]], i32 1 ; DEFAULT-NEXT: [[RES_UPTO1:%.*]] = select i1 [[INDEX_IS_1]], i32 [[SRC_I1]], i32 [[RES_UPTO0]] @@ -42,7 +42,7 @@ ; DEFAULT-NEXT: [[VAL0_I3:%.*]] = extractelement <4 x i32> [[VAL0]], i32 3 ; DEFAULT-NEXT: [[VAL1_I3:%.*]] = shl i32 4, [[VAL0_I3]] ; DEFAULT-NEXT: [[INDEX_IS_0:%.*]] = icmp eq i32 [[INDEX:%.*]], 0 -; DEFAULT-NEXT: [[VAL2_UPTO0:%.*]] = select i1 [[INDEX_IS_0]], i32 [[VAL1_I0]], i32 undef +; DEFAULT-NEXT: [[VAL2_UPTO0:%.*]] = select i1 [[INDEX_IS_0]], i32 [[VAL1_I0]], i32 poison ; DEFAULT-NEXT: [[INDEX_IS_1:%.*]] = icmp eq i32 [[INDEX]], 1 ; DEFAULT-NEXT: [[VAL2_UPTO1:%.*]] = select i1 [[INDEX_IS_1]], i32 [[VAL1_I1]], i32 [[VAL2_UPTO0]] ; DEFAULT-NEXT: [[INDEX_IS_2:%.*]] = icmp eq i32 [[INDEX]], 2 diff --git a/llvm/test/Transforms/Scalarizer/vector-of-pointer-to-vector.ll b/llvm/test/Transforms/Scalarizer/vector-of-pointer-to-vector.ll --- a/llvm/test/Transforms/Scalarizer/vector-of-pointer-to-vector.ll +++ b/llvm/test/Transforms/Scalarizer/vector-of-pointer-to-vector.ll @@ -6,7 +6,7 @@ ; CHECK-LABEL: @f1( ; CHECK-NEXT: [[INDEX_IS_0:%.*]] = icmp eq i32 [[INDEX:%.*]], 0 ; CHECK-NEXT: [[SRC_I0:%.*]] = extractelement <1 x ptr> [[SRC:%.*]], i32 0 -; CHECK-NEXT: [[DOTUPTO0:%.*]] = select i1 [[INDEX_IS_0]], ptr [[SRC_I0]], ptr undef +; CHECK-NEXT: [[DOTUPTO0:%.*]] = select i1 [[INDEX_IS_0]], ptr [[SRC_I0]], ptr poison ; CHECK-NEXT: [[DOTI0:%.*]] = load i32, ptr [[DOTUPTO0]], align 4 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <1 x i32> poison, i32 [[DOTI0]], i32 0 ; CHECK-NEXT: ret <1 x i32> [[TMP1]] @@ -32,7 +32,7 @@ ; CHECK-LABEL: @f2( ; CHECK-NEXT: [[INDEX_IS_0:%.*]] = icmp eq i32 [[INDEX:%.*]], 0 ; CHECK-NEXT: [[SRC_I0:%.*]] = extractelement <1 x ptr> [[SRC:%.*]], i32 0 -; CHECK-NEXT: [[DOTUPTO0:%.*]] = select i1 [[INDEX_IS_0]], ptr [[SRC_I0]], ptr undef +; CHECK-NEXT: [[DOTUPTO0:%.*]] = select i1 [[INDEX_IS_0]], ptr [[SRC_I0]], ptr poison ; CHECK-NEXT: [[DOTUPTO0_I1:%.*]] = getelementptr i32, ptr [[DOTUPTO0]], i32 1 ; CHECK-NEXT: [[DOTI0:%.*]] = load i32, ptr [[DOTUPTO0]], align 4 ; CHECK-NEXT: [[DOTI1:%.*]] = load i32, ptr [[DOTUPTO0_I1]], align 4 @@ -66,7 +66,7 @@ ; CHECK-NEXT: [[VAL_I1:%.*]] = extractelement <2 x i32> [[VAL]], i32 1 ; CHECK-NEXT: [[INDEX_IS_0:%.*]] = icmp eq i32 [[INDEX:%.*]], 0 ; CHECK-NEXT: [[SRC_I0:%.*]] = extractelement <1 x ptr> [[SRC:%.*]], i32 0 -; CHECK-NEXT: [[DOTUPTO0:%.*]] = select i1 [[INDEX_IS_0]], ptr [[SRC_I0]], ptr undef +; CHECK-NEXT: [[DOTUPTO0:%.*]] = select i1 [[INDEX_IS_0]], ptr [[SRC_I0]], ptr poison ; CHECK-NEXT: [[DOTUPTO0_I1:%.*]] = getelementptr i32, ptr [[DOTUPTO0]], i32 1 ; CHECK-NEXT: store i32 [[VAL_I0]], ptr [[DOTUPTO0]], align 4 ; CHECK-NEXT: store i32 [[VAL_I1]], ptr [[DOTUPTO0_I1]], align 4