From 718da3d1f6976a1bf89f960519ddab1316637c9a Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 29 Jul 2016 18:48:27 +0000 Subject: [ConstantFolding] Handle bitcasts of undef fp vector elements We used the wrong type for constructing a zero vector element which led to type mismatches. This fixes PR28771. llvm-svn: 277197 --- llvm/lib/Analysis/ConstantFolding.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 60b94a903e3..39e422f164c 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -187,7 +187,7 @@ Constant *FoldBitCast(Constant *C, Type *DestTy, const DataLayout &DL) { for (unsigned j = 0; j != Ratio; ++j) { Constant *Src = C->getAggregateElement(SrcElt++); if (Src && isa(Src)) - Src = Constant::getNullValue(SrcEltTy); + Src = Constant::getNullValue(C->getType()->getVectorElementType()); else Src = dyn_cast_or_null(Src); if (!Src) // Reject constantexpr elements. -- cgit v1.2.3