diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-02 23:35:28 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-02 23:35:28 +0000 |
| commit | a5dae0cac062a53edb2fc2dcd5be7658388d025a (patch) | |
| tree | bee5934b527949ad82396f183c92aca20de92219 /lib/Transforms/Scalar/LoopUnswitch.cpp | |
| parent | 4e69f48a0a6ef9b36c8f17d6ad4e3b6998c81078 (diff) | |
Use more efficient test for one value in a ConstantInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34859 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopUnswitch.cpp')
| -rw-r--r-- | lib/Transforms/Scalar/LoopUnswitch.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 861e97ce58..5274c9dd10 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -1048,7 +1048,7 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist) { cast<BinaryOperator>(I)->swapOperands(); if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1))) if (CB->getType() == Type::Int1Ty) { - if (CB->getZExtValue()) // X & 1 -> X + if (CB->isOne()) // X & 1 -> X ReplaceUsesOfWith(I, I->getOperand(0), Worklist); else // X & 0 -> 0 ReplaceUsesOfWith(I, I->getOperand(1), Worklist); @@ -1061,7 +1061,7 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist) { cast<BinaryOperator>(I)->swapOperands(); if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1))) if (CB->getType() == Type::Int1Ty) { - if (CB->getZExtValue()) // X | 1 -> 1 + if (CB->isOne()) // X | 1 -> 1 ReplaceUsesOfWith(I, I->getOperand(1), Worklist); else // X | 0 -> X ReplaceUsesOfWith(I, I->getOperand(0), Worklist); |
