From d43390498291c475a6e277fcd5d3bbf5abd3b41e Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Thu, 20 Nov 2008 04:36:13 +0000 Subject: [PATCH] undef beats zero. Fix this missed optimization opportunity. Patch by Matt Elder! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59705 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ConstantFolding.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index 9f94ee38337..597eecc1d23 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -281,7 +281,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy, Constant *llvm::ConstantFoldInstruction(Instruction *I, const TargetData *TD) { if (PHINode *PN = dyn_cast(I)) { if (PN->getNumIncomingValues() == 0) - return Constant::getNullValue(PN->getType()); + return UndefValue::get(PN->getType()); Constant *Result = dyn_cast(PN->getIncomingValue(0)); if (Result == 0) return 0;