[NFC][llvm] Inclusive language: reword and remove uses of sanity in llvm/lib/Target

Reworded removed code comments that contain `sanity check` and `sanity
test`.
This commit is contained in:
Zarko Todorovski 2021-11-17 21:59:00 -05:00
parent 4a9523c55f
commit 5b8bbbecfa
24 changed files with 31 additions and 33 deletions

View File

@ -8950,7 +8950,7 @@ SDValue AArch64TargetLowering::ReconstructShuffle(SDValue Op,
Src.WindowBase *= Src.WindowScale;
}
// Final sanity check before we try to actually produce a shuffle.
// Final check before we try to actually produce a shuffle.
LLVM_DEBUG(for (auto Src
: Sources)
assert(Src.ShuffleVec.getValueType() == ShuffleVT););

View File

@ -641,7 +641,7 @@ bool AArch64SIMDInstrOpt::processSeqRegInst(MachineInstr *DefiningMI,
StReg[i] = DefiningMI->getOperand(2*i+1).getReg();
StRegKill[i] = getKillRegState(DefiningMI->getOperand(2*i+1).isKill());
// Sanity check for the other arguments.
// Validation check for the other arguments.
if (DefiningMI->getOperand(2*i+2).isImm()) {
switch (DefiningMI->getOperand(2*i+2).getImm()) {
default:

View File

@ -1511,7 +1511,7 @@ public:
}
bool isAdrpLabel() const {
// Validation was handled during parsing, so we just sanity check that
// Validation was handled during parsing, so we just verify that
// something didn't go haywire.
if (!isImm())
return false;
@ -1527,7 +1527,7 @@ public:
}
bool isAdrLabel() const {
// Validation was handled during parsing, so we just sanity check that
// Validation was handled during parsing, so we just verify that
// something didn't go haywire.
if (!isImm())
return false;

View File

@ -2787,7 +2787,7 @@ bool AArch64InstructionSelector::select(MachineInstr &I) {
#ifndef NDEBUG
const Register PtrReg = LdSt.getPointerReg();
const RegisterBank &PtrRB = *RBI.getRegBank(PtrReg, MRI, TRI);
// Sanity-check the pointer register.
// Check that the pointer register is valid.
assert(PtrRB.getID() == AArch64::GPRRegBankID &&
"Load/Store pointer operand isn't a GPR");
assert(MRI.getType(PtrReg).isPointer() &&

View File

@ -225,7 +225,7 @@ void AMDGPUAsmPrinter::emitInstruction(const MachineInstr *MI) {
EmitToStreamer(*OutStreamer, TmpInst);
#ifdef EXPENSIVE_CHECKS
// Sanity-check getInstSizeInBytes on explicitly specified CPUs (it cannot
// Check getInstSizeInBytes on explicitly specified CPUs (it cannot
// work correctly for the generic CPU).
//
// The isPseudo check really shouldn't be here, but unfortunately there are

View File

@ -86,7 +86,7 @@ GetFunctionFromMDNode(MDNode *Node) {
if (!F)
return nullptr;
// Sanity checks.
// Validation checks.
size_t ExpectNumArgNodeOps = F->arg_size() + 1;
for (size_t i = 0; i < NumKernelArgMDNodes; ++i) {
MDNode *ArgNode = dyn_cast_or_null<MDNode>(Node->getOperand(i + 1));

View File

@ -646,7 +646,7 @@ void SIFoldOperands::foldOperand(
return;
if (frameIndexMayFold(TII, *UseMI, UseOpIdx, OpToFold)) {
// Sanity check that this is a stack access.
// Verify that this is a stack access.
// FIXME: Should probably use stack pseudos before frame lowering.
if (TII->isMUBUF(*UseMI)) {

View File

@ -534,7 +534,7 @@ SDValue ARCTargetLowering::LowerCallArguments(
CFRegNode.push_back(ArgIn.getValue(ArgIn->getNumValues() - 1));
}
} else {
// sanity check
// Only arguments passed on the stack should make it here.
assert(VA.isMemLoc());
// Load the argument to a virtual register
unsigned ObjSize = VA.getLocVT().getStoreSize();

View File

@ -4533,7 +4533,7 @@ SDValue ARMTargetLowering::LowerFormalArguments(
InVals.push_back(ArgValue);
} else { // VA.isRegLoc()
// sanity check
// Only arguments passed on the stack should make it here.
assert(VA.isMemLoc());
assert(VA.getValVT() != MVT::i64 && "i64 should already be lowered");
@ -8105,7 +8105,7 @@ SDValue ARMTargetLowering::ReconstructShuffle(SDValue Op,
Src.WindowBase *= Src.WindowScale;
}
// Final sanity check before we try to actually produce a shuffle.
// Final check before we try to actually produce a shuffle.
LLVM_DEBUG(for (auto Src
: Sources)
assert(Src.ShuffleVec.getValueType() == ShuffleVT););

View File

@ -331,7 +331,7 @@ void ARMAsmBackend::relaxInstruction(MCInst &Inst,
const MCSubtargetInfo &STI) const {
unsigned RelaxedOp = getRelaxedOpcode(Inst.getOpcode(), STI);
// Sanity check w/ diagnostic if we get here w/ a bogus instruction.
// Return a diagnostic if we get here w/ a bogus instruction.
if (RelaxedOp == Inst.getOpcode()) {
SmallString<256> Tmp;
raw_svector_ostream OS(Tmp);

View File

@ -1200,7 +1200,7 @@ SDValue AVRTargetLowering::LowerFormalArguments(
InVals.push_back(ArgValue);
} else {
// Sanity check.
// Only arguments passed on the stack should make it here.
assert(VA.isMemLoc());
EVT LocVT = VA.getLocVT();

View File

@ -822,7 +822,7 @@ BPFTargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
BuildMI(BB, DL, TII.get(NewCC)).addReg(LHS).addReg(RHS).addMBB(Copy1MBB);
} else {
int64_t imm32 = MI.getOperand(2).getImm();
// sanity check before we build J*_ri instruction.
// Check before we build J*_ri instruction.
assert (isInt<32>(imm32));
BuildMI(BB, DL, TII.get(NewCC))
.addReg(LHS).addImm(imm32).addMBB(Copy1MBB);

View File

@ -486,7 +486,7 @@ SDValue LanaiTargetLowering::LowerCCCArguments(
llvm_unreachable("unhandled argument type");
}
} else {
// Sanity check
// Only arguments passed on the stack should make it here.
assert(VA.isMemLoc());
// Load the argument to a virtual register
unsigned ObjSize = VA.getLocVT().getSizeInBits() / 8;

View File

@ -304,13 +304,11 @@ static bool isValidIndexedLoad(const LoadSDNode *LD) {
switch (VT.getSimpleVT().SimpleTy) {
case MVT::i8:
// Sanity check
if (cast<ConstantSDNode>(LD->getOffset())->getZExtValue() != 1)
return false;
break;
case MVT::i16:
// Sanity check
if (cast<ConstantSDNode>(LD->getOffset())->getZExtValue() != 2)
return false;

View File

@ -670,7 +670,7 @@ SDValue MSP430TargetLowering::LowerCCCArguments(
InVals.push_back(ArgValue);
}
} else {
// Sanity check
// Only arguments passed on the stack should make it here.
assert(VA.isMemLoc());
SDValue InVal;

View File

@ -3717,7 +3717,7 @@ SDValue MipsTargetLowering::LowerFormalArguments(
LocVT = VA.getValVT();
}
// sanity check
// Only arguments pased on the stack should make it here.
assert(VA.isMemLoc());
// The stack pointer offset is relative to the caller stack frame.

View File

@ -964,7 +964,7 @@ bool MipsSEDAGToDAGISel::trySelect(SDNode *Node) {
// match the instruction.
case MipsISD::Ins: {
// Sanity checking for the node operands.
// Validating the node operands.
if (Node->getValueType(0) != MVT::i32 && Node->getValueType(0) != MVT::i64)
return false;

View File

@ -7432,7 +7432,7 @@ bool RISCVTargetLowering::targetShrinkDemandedConstant(
else
return false;
// Sanity check that our new mask is a subset of the demanded mask.
// Check that our new mask is a subset of the demanded mask.
assert(IsLegalMask(NewMask));
return UseMask(NewMask);
}

View File

@ -99,7 +99,7 @@ static bool isUncondBranchOpcode(int Opc) {
#define BRKIND(NAME) (Opc == NAME##a || Opc == NAME##a_nt || Opc == NAME##a_t)
// VE has other branch relative always instructions for word/double/float,
// but we use only long branches in our lower. So, sanity check it here.
// but we use only long branches in our lower. So, check it here.
assert(!BRKIND(BRCFW) && !BRKIND(BRCFD) && !BRKIND(BRCFS) &&
"Branch relative word/double/float always instructions should not be "
"used!");
@ -127,7 +127,7 @@ static bool isIndirectBranchOpcode(int Opc) {
#define BRKIND(NAME) \
(Opc == NAME##ari || Opc == NAME##ari_nt || Opc == NAME##ari_t)
// VE has other branch always instructions for word/double/float, but
// we use only long branches in our lower. So, sanity check it here.
// we use only long branches in our lower. So, check it here.
assert(!BRKIND(BCFW) && !BRKIND(BCFD) && !BRKIND(BCFS) &&
"Branch word/double/float always instructions should not be used!");
return BRKIND(BCFL);

View File

@ -173,7 +173,7 @@ static bool explicitlyBranchesTo(MachineBasicBlock *Pred,
// satisfying the restrictions given by BeforeSet and AfterSet. BeforeSet
// contains instructions that should go before the marker, and AfterSet contains
// ones that should go after the marker. In this function, AfterSet is only
// used for sanity checking.
// used for validation checking.
template <typename Container>
static MachineBasicBlock::iterator
getEarliestInsertPos(MachineBasicBlock *MBB, const Container &BeforeSet,
@ -182,7 +182,7 @@ getEarliestInsertPos(MachineBasicBlock *MBB, const Container &BeforeSet,
while (InsertPos != MBB->begin()) {
if (BeforeSet.count(&*std::prev(InsertPos))) {
#ifndef NDEBUG
// Sanity check
// Validation check
for (auto Pos = InsertPos, E = MBB->begin(); Pos != E; --Pos)
assert(!AfterSet.count(&*std::prev(Pos)));
#endif
@ -197,7 +197,7 @@ getEarliestInsertPos(MachineBasicBlock *MBB, const Container &BeforeSet,
// satisfying the restrictions given by BeforeSet and AfterSet. BeforeSet
// contains instructions that should go before the marker, and AfterSet contains
// ones that should go after the marker. In this function, BeforeSet is only
// used for sanity checking.
// used for validation checking.
template <typename Container>
static MachineBasicBlock::iterator
getLatestInsertPos(MachineBasicBlock *MBB, const Container &BeforeSet,
@ -206,7 +206,7 @@ getLatestInsertPos(MachineBasicBlock *MBB, const Container &BeforeSet,
while (InsertPos != MBB->end()) {
if (AfterSet.count(&*InsertPos)) {
#ifndef NDEBUG
// Sanity check
// Validation check
for (auto Pos = InsertPos, E = MBB->end(); Pos != E; ++Pos)
assert(!BeforeSet.count(&*Pos));
#endif

View File

@ -68,7 +68,7 @@ bool LowerGlobalDtors::runOnModule(Module &M) {
if (!InitList)
return false;
// Sanity-check @llvm.global_dtor's type.
// Validate @llvm.global_dtor's type.
auto *ETy = dyn_cast<StructType>(InitList->getType()->getElementType());
if (!ETy || ETy->getNumElements() != 3 ||
!ETy->getTypeAtIndex(0U)->isIntegerTy() ||

View File

@ -2657,7 +2657,7 @@ bool X86AsmParser::ParseATTOperand(OperandVector &Operands) {
Expr = nullptr;
Reg = RE->getRegNo();
// Sanity check register.
// Check the register.
if (Reg == X86::EIZ || Reg == X86::RIZ)
return Error(
Loc, "%eiz and %riz can only be used as index registers",
@ -2917,7 +2917,7 @@ bool X86AsmParser::ParseMemOperand(unsigned SegReg, const MCExpr *Disp,
check(!isa<X86MCExpr>(E), BaseLoc, "expected register here"))
return true;
// Sanity check register.
// Check the register.
BaseReg = cast<X86MCExpr>(E)->getRegNo();
if (BaseReg == X86::EIZ || BaseReg == X86::RIZ)
return Error(BaseLoc, "eiz and riz can only be used as index registers",

View File

@ -6342,7 +6342,7 @@ static SDValue splitVectorIntUnary(SDValue Op, SelectionDAG &DAG) {
/// Break a binary integer operation into 2 half sized ops and then
/// concatenate the result back.
static SDValue splitVectorIntBinary(SDValue Op, SelectionDAG &DAG) {
// Sanity check that all the types match.
// Assert that all the types match.
EVT VT = Op.getValueType();
(void)VT;
assert(Op.getOperand(0).getValueType() == VT &&
@ -25424,7 +25424,7 @@ SDValue X86TargetLowering::LowerVAARG(SDValue Op, SelectionDAG &DAG) const {
}
if (ArgMode == 2) {
// Sanity Check: Make sure using fp_offset makes sense.
// Make sure using fp_offset makes sense.
assert(!Subtarget.useSoftFloat() &&
!(MF.getFunction().hasFnAttribute(Attribute::NoImplicitFloat)) &&
Subtarget.hasSSE1());

View File

@ -1315,7 +1315,7 @@ SDValue XCoreTargetLowering::LowerCCCArguments(
CFRegNode.push_back(ArgIn.getValue(ArgIn->getNumValues() - 1));
}
} else {
// sanity check
// Only arguments passed on the stack should make it here.
assert(VA.isMemLoc());
// Load the argument to a virtual register
unsigned ObjSize = VA.getLocVT().getSizeInBits()/8;