Handle functions with no name better.
authorChris Lattner <sabre@nondot.org>
Wed, 8 Aug 2007 16:07:23 +0000 (16:07 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 8 Aug 2007 16:07:23 +0000 (16:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40926 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ConstantFolding.cpp

index 2422c4870aa31a0a7c7cbab8683d40e4236fd096..9599a900f263339c474767ddbe5e3b5a50a84901 100644 (file)
@@ -327,9 +327,9 @@ llvm::canConstantFoldCallTo(Function *F) {
   }
 
   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 @@ static Constant *ConstantFoldBinaryFP(double (*NativeFP)(double, double),
 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();