[llvm-commits] [llvm] r40926 - /llvm/trunk/lib/Analysis/ConstantFolding.cpp

Chris Lattner sabre at nondot.org
Wed Aug 8 09:07:24 PDT 2007


Author: lattner
Date: Wed Aug  8 11:07:23 2007
New Revision: 40926

URL: http://llvm.org/viewvc/llvm-project?rev=40926&view=rev
Log:
Handle functions with no name better.

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=40926&r1=40925&r2=40926&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Wed Aug  8 11:07:23 2007
@@ -327,9 +327,9 @@
   }
 
   const ValueName *NameVal = F->getValueName();
+  if (NameVal == 0) return false;
   const char *Str = NameVal->getKeyData();
   unsigned Len = NameVal->getKeyLength();
-  if (Len == 0) return false;
   
   // In these cases, the check of the length is required.  We don't want to
   // return true for a name like "cos\0blah" which strcmp would return equal to
@@ -414,6 +414,7 @@
 Constant *
 llvm::ConstantFoldCall(Function *F, Constant** Operands, unsigned NumOperands) {
   const ValueName *NameVal = F->getValueName();
+  if (NameVal == 0) return 0;
   const char *Str = NameVal->getKeyData();
   unsigned Len = NameVal->getKeyLength();
   





More information about the llvm-commits mailing list