aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/ConstantFolding.cpp')
-rw-r--r--lib/Analysis/ConstantFolding.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 2422c4870a..9599a900f2 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -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();