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/Scalar/Reassociate.cpp | |
| 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/Scalar/Reassociate.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/Reassociate.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index aa851b290f4..8030a76eced 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -536,7 +536,7 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I, switch (Opcode) { default: break; case Instruction::And: - if (CstVal->isNullValue()) { // ... & 0 -> 0 + if (CstVal->isZero()) { // ... & 0 -> 0 ++NumAnnihil; return CstVal; } else if (CstVal->isAllOnesValue()) { // ... & -1 -> ... @@ -544,10 +544,10 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I, } break; case Instruction::Mul: - if (CstVal->isNullValue()) { // ... * 0 -> 0 + if (CstVal->isZero()) { // ... * 0 -> 0 ++NumAnnihil; return CstVal; - } else if (cast<ConstantInt>(CstVal)->isUnitValue()) { + } else if (cast<ConstantInt>(CstVal)->isOne()) { Ops.pop_back(); // ... * 1 -> ... } break; @@ -559,7 +559,7 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I, // FALLTHROUGH! case Instruction::Add: case Instruction::Xor: - if (CstVal->isNullValue()) // ... [|^+] 0 -> ... + if (CstVal->isZero()) // ... [|^+] 0 -> ... Ops.pop_back(); break; } |

