[llvm] 795602a - [CodeGen] Don't compare bool with integer 0. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 17 23:16:56 PDT 2022
Author: Craig Topper
Date: 2022-07-17T23:16:14-07:00
New Revision: 795602af0c20ad54189f94d13017b276c920d6f9
URL: https://github.com/llvm/llvm-project/commit/795602af0c20ad54189f94d13017b276c920d6f9
DIFF: https://github.com/llvm/llvm-project/commit/795602af0c20ad54189f94d13017b276c920d6f9.diff
LOG: [CodeGen] Don't compare bool with integer 0. NFC
The IsAdd field is a bool.
Added:
Modified:
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
index ad0c0c8315dcb..e7166f9f6a1d2 100644
--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
@@ -4806,18 +4806,18 @@ MachineInstr *CombinerHelper::buildUDivUsingMul(MachineInstr &MI) {
// If the divisor is even, we can avoid using the expensive fixup by
// shifting the divided value upfront.
- if (magics.IsAdd != 0 && !Divisor[0]) {
+ if (magics.IsAdd && !Divisor[0]) {
PreShift = Divisor.countTrailingZeros();
// Get magic number for the shifted divisor.
magics =
UnsignedDivisonByConstantInfo::get(Divisor.lshr(PreShift), PreShift);
- assert(magics.IsAdd == 0 && "Should use cheap fixup now");
+ assert(!magics.IsAdd && "Should use cheap fixup now");
}
APInt Magic = magics.Magic;
unsigned SelNPQ;
- if (magics.IsAdd == 0 || Divisor.isOneValue()) {
+ if (!magics.IsAdd || Divisor.isOneValue()) {
assert(magics.ShiftAmount < Divisor.getBitWidth() &&
"We shouldn't generate an undefined shift!");
PostShift = magics.ShiftAmount;
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index b15383a787b5b..131310af3150a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -5910,17 +5910,17 @@ SDValue TargetLowering::BuildUDIV(SDNode *N, SelectionDAG &DAG,
// If the divisor is even, we can avoid using the expensive fixup by
// shifting the divided value upfront.
- if (magics.IsAdd != 0 && !Divisor[0]) {
+ if (magics.IsAdd && !Divisor[0]) {
PreShift = Divisor.countTrailingZeros();
// Get magic number for the shifted divisor.
magics = UnsignedDivisonByConstantInfo::get(Divisor.lshr(PreShift), PreShift);
- assert(magics.IsAdd == 0 && "Should use cheap fixup now");
+ assert(!magics.IsAdd && "Should use cheap fixup now");
}
APInt Magic = magics.Magic;
unsigned SelNPQ;
- if (magics.IsAdd == 0 || Divisor.isOne()) {
+ if (!magics.IsAdd || Divisor.isOne()) {
assert(magics.ShiftAmount < Divisor.getBitWidth() &&
"We shouldn't generate an undefined shift!");
PostShift = magics.ShiftAmount;
More information about the llvm-commits
mailing list