diff options
author | Craig Topper <craig.topper@gmail.com> | 2017-06-07 07:40:37 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2017-06-07 07:40:37 +0000 |
commit | 73ba1c84beadc3dfc6cf11fc971d97eba48c956e (patch) | |
tree | 30a24b6376062d7af27f4b025ca9fff592584989 /llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | |
parent | 29c282eac8840e461d14c157fd3529e2adb513e9 (diff) | |
download | llvm-73ba1c84beadc3dfc6cf11fc971d97eba48c956e.zip llvm-73ba1c84beadc3dfc6cf11fc971d97eba48c956e.tar.gz llvm-73ba1c84beadc3dfc6cf11fc971d97eba48c956e.tar.bz2 |
[InstCombine][InstSimplify] Use APInt::isNullValue/isOneValue to reduce compiled code for comparing APInts with 0 and 1. NFC
These methods are specifically optimized to only counting leading zeros without an additional uint64_t compare.
llvm-svn: 304876
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index 7afb881..229d59a 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -1478,9 +1478,9 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { if (!CondVal->getType()->isVectorTy() && !AC.assumptions().empty()) { KnownBits Known(1); computeKnownBits(CondVal, Known, 0, &SI); - if (Known.One == 1) + if (Known.One.isOneValue()) return replaceInstUsesWith(SI, TrueVal); - if (Known.Zero == 1) + if (Known.Zero.isOneValue()) return replaceInstUsesWith(SI, FalseVal); } |