mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-27 21:50:40 +00:00
Simplify expressions involving boolean constants with clang-tidy
Patch by Richard (legalize at xmission dot com). Differential Revision: http://reviews.llvm.org/D8154 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231617 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c03496d4d0
commit
da4471d726
@ -6198,7 +6198,7 @@ ScalarEvolution::HowFarToZero(const SCEV *V, const Loop *L, bool ControlsExit) {
|
||||
dyn_cast<ConstantInt>(ConstantExpr::getICmp(CmpInst::ICMP_ULT,
|
||||
R1->getValue(),
|
||||
R2->getValue()))) {
|
||||
if (CB->getZExtValue() == false)
|
||||
if (!CB->getZExtValue())
|
||||
std::swap(R1, R2); // R1 is the minimum root now.
|
||||
|
||||
// We can only use this value if the chrec ends up with an exact zero
|
||||
@ -7521,7 +7521,7 @@ const SCEV *SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range,
|
||||
if (ConstantInt *CB =
|
||||
dyn_cast<ConstantInt>(ConstantExpr::getICmp(ICmpInst::ICMP_ULT,
|
||||
R1->getValue(), R2->getValue()))) {
|
||||
if (CB->getZExtValue() == false)
|
||||
if (!CB->getZExtValue())
|
||||
std::swap(R1, R2); // R1 is the minimum root now.
|
||||
|
||||
// Make sure the root is not off by one. The returned iteration should
|
||||
|
@ -245,7 +245,7 @@ void BitstreamCursor::ReadAbbrevRecord() {
|
||||
BitCodeAbbrev *Abbv = new BitCodeAbbrev();
|
||||
unsigned NumOpInfo = ReadVBR(5);
|
||||
for (unsigned i = 0; i != NumOpInfo; ++i) {
|
||||
bool IsLiteral = Read(1) ? true : false;
|
||||
bool IsLiteral = Read(1);
|
||||
if (IsLiteral) {
|
||||
Abbv->Add(BitCodeAbbrevOp(ReadVBR64(8)));
|
||||
continue;
|
||||
|
@ -4466,8 +4466,7 @@ static void scaleWeights(uint64_t &NewTrue, uint64_t &NewFalse) {
|
||||
/// FIXME: Remove the (equivalent?) implementation in SelectionDAG.
|
||||
///
|
||||
bool CodeGenPrepare::splitBranchCondition(Function &F) {
|
||||
if (!TM || TM->Options.EnableFastISel != true ||
|
||||
!TLI || TLI->isJumpExpensive())
|
||||
if (!TM || !TM->Options.EnableFastISel || !TLI || TLI->isJumpExpensive())
|
||||
return false;
|
||||
|
||||
bool MadeChange = false;
|
||||
|
@ -247,7 +247,7 @@ namespace {
|
||||
return true;
|
||||
else if (Incr1 == Incr2) {
|
||||
// Favors subsumption.
|
||||
if (C1->NeedSubsumption == false && C2->NeedSubsumption == true)
|
||||
if (!C1->NeedSubsumption && C2->NeedSubsumption)
|
||||
return true;
|
||||
else if (C1->NeedSubsumption == C2->NeedSubsumption) {
|
||||
// Favors diamond over triangle, etc.
|
||||
|
@ -915,7 +915,7 @@ bool PeepholeOptimizer::optimizeCoalescableCopy(MachineInstr *MI) {
|
||||
// => v0 = COPY v1
|
||||
// Currently we haven't seen motivating example for that and we
|
||||
// want to avoid untested code.
|
||||
NumRewrittenCopies += Changed == true;
|
||||
NumRewrittenCopies += Changed;
|
||||
return Changed;
|
||||
}
|
||||
|
||||
|
@ -1128,7 +1128,7 @@ relocation_iterator RuntimeDyldELF::processRelocationRef(
|
||||
RangeOverflow = true;
|
||||
}
|
||||
}
|
||||
if (SymType == SymbolRef::ST_Unknown || RangeOverflow == true) {
|
||||
if (SymType == SymbolRef::ST_Unknown || RangeOverflow) {
|
||||
// It is an external symbol (SymbolRef::ST_Unknown) or within a range
|
||||
// larger than 24-bits.
|
||||
StubMap::const_iterator i = Stubs.find(Value);
|
||||
|
@ -129,7 +129,7 @@ void DiagnosticInfoSampleProfile::print(DiagnosticPrinter &DP) const {
|
||||
}
|
||||
|
||||
bool DiagnosticInfoOptimizationBase::isLocationAvailable() const {
|
||||
return getDebugLoc().isUnknown() == false;
|
||||
return !getDebugLoc().isUnknown();
|
||||
}
|
||||
|
||||
void DiagnosticInfoOptimizationBase::getLocation(StringRef *Filename,
|
||||
|
@ -75,7 +75,7 @@ bool InlineAsm::ConstraintInfo::Parse(StringRef Str,
|
||||
ConstraintCodeVector *pCodes = &Codes;
|
||||
|
||||
// Initialize
|
||||
isMultipleAlternative = (multipleAlternativeCount > 1 ? true : false);
|
||||
isMultipleAlternative = multipleAlternativeCount > 1;
|
||||
if (isMultipleAlternative) {
|
||||
multipleAlternatives.resize(multipleAlternativeCount);
|
||||
pCodes = &multipleAlternatives[0].Codes;
|
||||
|
@ -2709,7 +2709,7 @@ Verifier::VerifyIntrinsicIsVarArg(bool isVarArg,
|
||||
|
||||
// If there are no descriptors left, then it can't be a vararg.
|
||||
if (Infos.empty())
|
||||
return isVarArg ? true : false;
|
||||
return isVarArg;
|
||||
|
||||
// There should be only one descriptor remaining at this point.
|
||||
if (Infos.size() != 1)
|
||||
@ -2719,7 +2719,7 @@ Verifier::VerifyIntrinsicIsVarArg(bool isVarArg,
|
||||
IITDescriptor D = Infos.front();
|
||||
Infos = Infos.slice(1);
|
||||
if (D.Kind == IITDescriptor::VarArg)
|
||||
return isVarArg ? false : true;
|
||||
return !isVarArg;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2791,7 +2791,7 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
|
||||
if (FileNumber == -1)
|
||||
getStreamer().EmitFileDirective(Filename);
|
||||
else {
|
||||
if (getContext().getGenDwarfForAssembly() == true)
|
||||
if (getContext().getGenDwarfForAssembly())
|
||||
Error(DirectiveLoc,
|
||||
"input can't have .file dwarf directives when -g is "
|
||||
"used to generate dwarf debug info for assembly code");
|
||||
|
@ -626,7 +626,7 @@ bool DarwinAsmParser::parseDirectiveSecureLogUnique(StringRef, SMLoc IDLoc) {
|
||||
if (getLexer().isNot(AsmToken::EndOfStatement))
|
||||
return TokError("unexpected token in '.secure_log_unique' directive");
|
||||
|
||||
if (getContext().getSecureLogUsed() != false)
|
||||
if (getContext().getSecureLogUsed())
|
||||
return Error(IDLoc, ".secure_log_unique specified multiple times");
|
||||
|
||||
// Get the secure log path.
|
||||
|
@ -1248,10 +1248,10 @@ APFloat::roundAwayFromZero(roundingMode rounding_mode,
|
||||
return false;
|
||||
|
||||
case rmTowardPositive:
|
||||
return sign == false;
|
||||
return !sign;
|
||||
|
||||
case rmTowardNegative:
|
||||
return sign == true;
|
||||
return sign;
|
||||
}
|
||||
llvm_unreachable("Invalid rounding mode found");
|
||||
}
|
||||
|
@ -1516,7 +1516,7 @@ public:
|
||||
|
||||
// Invoke the printer.
|
||||
void operator=(bool Value) {
|
||||
if (Value == false)
|
||||
if (!Value)
|
||||
return;
|
||||
|
||||
StrOptionPairVector Opts;
|
||||
@ -1716,7 +1716,7 @@ static cl::opt<bool> PrintAllOptions(
|
||||
cl::init(false), cl::cat(GenericCategory));
|
||||
|
||||
void HelpPrinterWrapper::operator=(bool Value) {
|
||||
if (Value == false)
|
||||
if (!Value)
|
||||
return;
|
||||
|
||||
// Decide which printer to invoke. If more than one option category is
|
||||
|
@ -120,7 +120,7 @@ bool NVPTXLowerAggrCopies::runOnFunction(Function &F) {
|
||||
++II) {
|
||||
if (LoadInst *load = dyn_cast<LoadInst>(II)) {
|
||||
|
||||
if (load->hasOneUse() == false)
|
||||
if (!load->hasOneUse())
|
||||
continue;
|
||||
|
||||
if (DL.getTypeStoreSize(load->getType()) < MaxAggrCopySize)
|
||||
|
@ -927,7 +927,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
|
||||
return BinaryOperator::CreateAnd(NotCond, FalseVal);
|
||||
}
|
||||
if (ConstantInt *C = dyn_cast<ConstantInt>(FalseVal)) {
|
||||
if (C->getZExtValue() == false) {
|
||||
if (!C->getZExtValue()) {
|
||||
// Change: A = select B, C, false --> A = and B, C
|
||||
return BinaryOperator::CreateAnd(CondVal, TrueVal);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user