diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-02 00:28:52 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-02 00:28:52 +0000 |
| commit | 2e54a15943637fd337ed2e17e17879ff735f5bf2 (patch) | |
| tree | 92aac23fc083d008216073abe2ea135578ebbb8c /llvm/lib/Transforms/IPO | |
| parent | 3f770e4afdcc7e1fd7b933c5ec98f38c69ba0c89 (diff) | |
| download | bcm5719-llvm-2e54a15943637fd337ed2e17e17879ff735f5bf2.tar.gz bcm5719-llvm-2e54a15943637fd337ed2e17e17879ff735f5bf2.zip | |
Prefer non-virtual calls to ConstantInt::isZero over virtual calls to
Constant::isNullValue() in situations where it is possible.
llvm-svn: 34821
Diffstat (limited to 'llvm/lib/Transforms/IPO')
| -rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index dbdea1ecdd7..89850d2e3da 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -1155,7 +1155,7 @@ static void ShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) { // instead of a select to synthesize the desired value. bool IsOneZero = false; if (ConstantInt *CI = dyn_cast<ConstantInt>(OtherVal)) - IsOneZero = InitVal->isNullValue() && CI->equalsInt(1); + IsOneZero = InitVal->isNullValue() && CI->isOne(); while (!GV->use_empty()) { Instruction *UI = cast<Instruction>(GV->use_back()); diff --git a/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp b/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp index 08286216f91..6d719258678 100644 --- a/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp +++ b/llvm/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 |

