[llvm-commits] [llvm] r59705 - /llvm/trunk/lib/Analysis/ConstantFolding.cpp
Nick Lewycky
nicholas at mxc.ca
Wed Nov 19 20:36:14 PST 2008
Author: nicholas
Date: Wed Nov 19 22:36:13 2008
New Revision: 59705
URL: http://llvm.org/viewvc/llvm-project?rev=59705&view=rev
Log:
undef beats zero. Fix this missed optimization opportunity. Patch by Matt Elder!
Modified:
llvm/trunk/lib/Analysis/ConstantFolding.cpp
Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=59705&r1=59704&r2=59705&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Wed Nov 19 22:36:13 2008
@@ -281,7 +281,7 @@
Constant *llvm::ConstantFoldInstruction(Instruction *I, const TargetData *TD) {
if (PHINode *PN = dyn_cast<PHINode>(I)) {
if (PN->getNumIncomingValues() == 0)
- return Constant::getNullValue(PN->getType());
+ return UndefValue::get(PN->getType());
Constant *Result = dyn_cast<Constant>(PN->getIncomingValue(0));
if (Result == 0) return 0;
More information about the llvm-commits
mailing list