[Support][CodeGen] Fix spelling Divison->Division. NFC

This commit is contained in:
Craig Topper 2022-07-17 22:56:57 -07:00
parent 795602af0c
commit a55ff6aadd
4 changed files with 15 additions and 13 deletions

View File

@ -1,4 +1,4 @@
//== llvm/Support/DivisonByConstantInfo.h - division by constant -*- C++ -*-==//
//===- llvm/Support/DivisionByConstantInfo.h ---------------------*- C++ -*-==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@ -25,9 +25,9 @@ struct SignedDivisionByConstantInfo {
};
/// Magic data for optimising unsigned division by a constant.
struct UnsignedDivisonByConstantInfo {
static UnsignedDivisonByConstantInfo get(const APInt &D,
unsigned LeadingZeros = 0);
struct UnsignedDivisionByConstantInfo {
static UnsignedDivisionByConstantInfo get(const APInt &D,
unsigned LeadingZeros = 0);
APInt Magic; ///< magic number
bool IsAdd; ///< add indicator
unsigned ShiftAmount; ///< shift amount

View File

@ -4800,8 +4800,8 @@ MachineInstr *CombinerHelper::buildUDivUsingMul(MachineInstr &MI) {
auto BuildUDIVPattern = [&](const Constant *C) {
auto *CI = cast<ConstantInt>(C);
const APInt &Divisor = CI->getValue();
UnsignedDivisonByConstantInfo magics =
UnsignedDivisonByConstantInfo::get(Divisor);
UnsignedDivisionByConstantInfo magics =
UnsignedDivisionByConstantInfo::get(Divisor);
unsigned PreShift = 0, PostShift = 0;
// If the divisor is even, we can avoid using the expensive fixup by
@ -4810,7 +4810,7 @@ MachineInstr *CombinerHelper::buildUDivUsingMul(MachineInstr &MI) {
PreShift = Divisor.countTrailingZeros();
// Get magic number for the shifted divisor.
magics =
UnsignedDivisonByConstantInfo::get(Divisor.lshr(PreShift), PreShift);
UnsignedDivisionByConstantInfo::get(Divisor.lshr(PreShift), PreShift);
assert(!magics.IsAdd && "Should use cheap fixup now");
}

View File

@ -5905,7 +5905,8 @@ SDValue TargetLowering::BuildUDIV(SDNode *N, SelectionDAG &DAG,
// FIXME: We should use a narrower constant when the upper
// bits are known to be zero.
const APInt& Divisor = C->getAPIntValue();
UnsignedDivisonByConstantInfo magics = UnsignedDivisonByConstantInfo::get(Divisor);
UnsignedDivisionByConstantInfo magics =
UnsignedDivisionByConstantInfo::get(Divisor);
unsigned PreShift = 0, PostShift = 0;
// If the divisor is even, we can avoid using the expensive fixup by
@ -5913,7 +5914,8 @@ SDValue TargetLowering::BuildUDIV(SDNode *N, SelectionDAG &DAG,
if (magics.IsAdd && !Divisor[0]) {
PreShift = Divisor.countTrailingZeros();
// Get magic number for the shifted divisor.
magics = UnsignedDivisonByConstantInfo::get(Divisor.lshr(PreShift), PreShift);
magics =
UnsignedDivisionByConstantInfo::get(Divisor.lshr(PreShift), PreShift);
assert(!magics.IsAdd && "Should use cheap fixup now");
}

View File

@ -1,4 +1,4 @@
//===----- DivisonByConstantInfo.cpp - division by constant -*- C++ -*-----===//
//===----- DivisionByConstantInfo.cpp - division by constant -*- C++ -*----===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@ -62,11 +62,11 @@ SignedDivisionByConstantInfo SignedDivisionByConstantInfo::get(const APInt &D) {
/// S. Warren, Jr., chapter 10.
/// LeadingZeros can be used to simplify the calculation if the upper bits
/// of the divided value are known zero.
UnsignedDivisonByConstantInfo
UnsignedDivisonByConstantInfo::get(const APInt &D, unsigned LeadingZeros) {
UnsignedDivisionByConstantInfo
UnsignedDivisionByConstantInfo::get(const APInt &D, unsigned LeadingZeros) {
unsigned P;
APInt NC, Delta, Q1, R1, Q2, R2;
struct UnsignedDivisonByConstantInfo Retval;
struct UnsignedDivisionByConstantInfo Retval;
Retval.IsAdd = false; // initialize "add" indicator
APInt AllOnes = APInt::getAllOnes(D.getBitWidth()).lshr(LeadingZeros);
APInt SignedMin = APInt::getSignedMinValue(D.getBitWidth());