diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Transforms/Scalar/Reassociate.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Scalar/Reassociate.cpp b/contrib/llvm-project/llvm/lib/Transforms/Scalar/Reassociate.cpp index 888edc4d69a8..b0fb8daaba8f 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -140,7 +140,7 @@ XorOpnd::XorOpnd(Value *V) { // view the operand as "V | 0" SymbolicPart = V; - ConstPart = APInt::getNullValue(V->getType()->getScalarSizeInBits()); + ConstPart = APInt::getZero(V->getType()->getScalarSizeInBits()); isOr = true; } @@ -1279,10 +1279,10 @@ static Value *OptimizeAndOrXor(unsigned Opcode, /// be returned. static Value *createAndInstr(Instruction *InsertBefore, Value *Opnd, const APInt &ConstOpnd) { - if (ConstOpnd.isNullValue()) + if (ConstOpnd.isZero()) return nullptr; - if (ConstOpnd.isAllOnesValue()) + if (ConstOpnd.isAllOnes()) return Opnd; Instruction *I = BinaryOperator::CreateAnd( @@ -1304,7 +1304,7 @@ bool ReassociatePass::CombineXorOpnd(Instruction *I, XorOpnd *Opnd1, // = ((x | c1) ^ c1) ^ (c1 ^ c2) // = (x & ~c1) ^ (c1 ^ c2) // It is useful only when c1 == c2. - if (!Opnd1->isOrExpr() || Opnd1->getConstPart().isNullValue()) + if (!Opnd1->isOrExpr() || Opnd1->getConstPart().isZero()) return false; if (!Opnd1->getValue()->hasOneUse()) @@ -1361,7 +1361,7 @@ bool ReassociatePass::CombineXorOpnd(Instruction *I, XorOpnd *Opnd1, APInt C3((~C1) ^ C2); // Do not increase code size! - if (!C3.isNullValue() && !C3.isAllOnesValue()) { + if (!C3.isZero() && !C3.isAllOnes()) { int NewInstNum = ConstOpnd.getBoolValue() ? 1 : 2; if (NewInstNum > DeadInstNum) return false; @@ -1377,7 +1377,7 @@ bool ReassociatePass::CombineXorOpnd(Instruction *I, XorOpnd *Opnd1, APInt C3 = C1 ^ C2; // Do not increase code size - if (!C3.isNullValue() && !C3.isAllOnesValue()) { + if (!C3.isZero() && !C3.isAllOnes()) { int NewInstNum = ConstOpnd.getBoolValue() ? 1 : 2; if (NewInstNum > DeadInstNum) return false; @@ -1468,8 +1468,7 @@ Value *ReassociatePass::OptimizeXor(Instruction *I, Value *CV; // Step 3.1: Try simplifying "CurrOpnd ^ ConstOpnd" - if (!ConstOpnd.isNullValue() && - CombineXorOpnd(I, CurrOpnd, ConstOpnd, CV)) { + if (!ConstOpnd.isZero() && CombineXorOpnd(I, CurrOpnd, ConstOpnd, CV)) { Changed = true; if (CV) *CurrOpnd = XorOpnd(CV); @@ -1510,7 +1509,7 @@ Value *ReassociatePass::OptimizeXor(Instruction *I, ValueEntry VE(getRank(O.getValue()), O.getValue()); Ops.push_back(VE); } - if (!ConstOpnd.isNullValue()) { + if (!ConstOpnd.isZero()) { Value *C = ConstantInt::get(Ty, ConstOpnd); ValueEntry VE(getRank(C), C); Ops.push_back(VE); @@ -1519,7 +1518,7 @@ Value *ReassociatePass::OptimizeXor(Instruction *I, if (Sz == 1) return Ops.back().Op; if (Sz == 0) { - assert(ConstOpnd.isNullValue()); + assert(ConstOpnd.isZero()); return ConstantInt::get(Ty, ConstOpnd); } } |