summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-02 00:28:52 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-02 00:28:52 +0000
commitcae5754619433aed7be74abbf1c0551a82d369cb (patch)
tree77599913d2e900d4774e81cce3333f31f25c9fa6 /lib/Transforms/IPO/SimplifyLibCalls.cpp
parent34da0ac28f7bfe737f92d3a098697a6ebc09a25e (diff)
downloadllvm-cae5754619433aed7be74abbf1c0551a82d369cb.tar.gz
llvm-cae5754619433aed7be74abbf1c0551a82d369cb.tar.bz2
llvm-cae5754619433aed7be74abbf1c0551a82d369cb.tar.xz
Prefer non-virtual calls to ConstantInt::isZero over virtual calls to
Constant::isNullValue() in situations where it is possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34821 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/SimplifyLibCalls.cpp')
-rw-r--r--lib/Transforms/IPO/SimplifyLibCalls.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp
index 08286216f9..6d71925867 100644
--- a/lib/Transforms/IPO/SimplifyLibCalls.cpp
+++ b/lib/Transforms/IPO/SimplifyLibCalls.cpp
@@ -584,7 +584,7 @@ public:
for (uint64_t i = 0; i < len; ++i) {
if (ConstantInt* CI = dyn_cast<ConstantInt>(CA->getOperand(i))) {
// Check for the null terminator
- if (CI->isNullValue())
+ if (CI->isZero())
break; // we found end of string
else if (CI->getSExtValue() == chr) {
char_found = true;
@@ -2023,7 +2023,7 @@ static bool getConstantStringLength(Value *V, uint64_t &len, ConstantArray **CA)
// Check to make sure that the first operand of the GEP is an integer and
// has value 0 so that we are sure we're indexing into the initializer.
if (ConstantInt* op1 = dyn_cast<ConstantInt>(GEP->getOperand(1))) {
- if (!op1->isNullValue())
+ if (!op1->isZero())
return false;
} else
return false;
@@ -2069,7 +2069,7 @@ static bool getConstantStringLength(Value *V, uint64_t &len, ConstantArray **CA)
for (len = start_idx; len < max_elems; len++) {
if (ConstantInt *CI = dyn_cast<ConstantInt>(A->getOperand(len))) {
// Check for the null terminator
- if (CI->isNullValue())
+ if (CI->isZero())
break; // we found end of string
} else
return false; // This array isn't suitable, non-int initializer