Skip to content

[clang][lldb][mlir] Fix some identical sub-expressions warnings (NFC) #95715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,10 @@ class HTMLLogger : public Logger {
AST.getSourceManager(), AST.getLangOpts());
if (EltRange.isInvalid())
continue;
if (EltRange.getBegin() < Range.getBegin() ||
EltRange.getEnd() >= Range.getEnd() ||
EltRange.getEnd() < Range.getBegin() ||
EltRange.getEnd() >= Range.getEnd())
if (EltRange.getEnd() < Range.getBegin() ||
EltRange.getBegin() >= Range.getEnd())
continue;

unsigned Off = EltRange.getBegin().getRawEncoding() -
Range.getBegin().getRawEncoding();
unsigned Len = EltRange.getEnd().getRawEncoding() -
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/Sema/SemaCast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2945,8 +2945,7 @@ void CastOperation::CheckCStyleCast() {
if (Self.getASTContext().isDependenceAllowed() &&
(DestType->isDependentType() || SrcExpr.get()->isTypeDependent() ||
SrcExpr.get()->isValueDependent())) {
assert((DestType->containsErrors() || SrcExpr.get()->containsErrors() ||
SrcExpr.get()->containsErrors()) &&
assert((DestType->containsErrors() || SrcExpr.get()->containsErrors()) &&
"should only occur in error-recovery path.");
assert(Kind == CK_Dependent);
return;
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/Sema/SemaOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23087,8 +23087,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPDoacrossClause(
if (DSAStack->getCurrentDirective() == OMPD_ordered &&
DepType != OMPC_DOACROSS_source && DepType != OMPC_DOACROSS_sink &&
DepType != OMPC_DOACROSS_sink_omp_cur_iteration &&
DepType != OMPC_DOACROSS_source_omp_cur_iteration &&
DepType != OMPC_DOACROSS_source) {
DepType != OMPC_DOACROSS_source_omp_cur_iteration) {
Diag(DepLoc, diag::err_omp_unexpected_clause_value)
<< "'source' or 'sink'" << getOpenMPClauseName(OMPC_doacross);
return nullptr;
Expand Down
7 changes: 5 additions & 2 deletions llvm/lib/Transforms/Scalar/JumpThreading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2380,7 +2380,10 @@ void JumpThreadingPass::threadEdge(BasicBlock *BB,
// Build BPI/BFI before any changes are made to IR.
bool HasProfile = doesBlockHaveProfileData(BB);
auto *BFI = getOrCreateBFI(HasProfile);
auto *BPI = getOrCreateBPI(BFI != nullptr);
BranchProbabilityInfo *BPI = nullptr;
if (BFI) {
BPI = getOrCreateBPI(true);
}

// And finally, do it! Start by factoring the predecessors if needed.
BasicBlock *PredBB;
Expand Down Expand Up @@ -2520,7 +2523,7 @@ void JumpThreadingPass::updateBlockFreqAndEdgeWeight(BasicBlock *PredBB,
BlockFrequencyInfo *BFI,
BranchProbabilityInfo *BPI,
bool HasProfile) {
assert(((BFI && BPI) || (!BFI && !BFI)) &&
assert(((BFI && BPI) || (!BFI && !BPI)) &&
"Both BFI & BPI should either be set or unset");

if (!BFI) {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ void PlainCFGBuilder::buildPlainCFG() {
: static_cast<VPBlockBase *>(Successor));
continue;
}
assert(BI->isConditional() && NumSuccs == 2 && BI->isConditional() &&
assert(BI->isConditional() && NumSuccs == 2 &&
"block must have conditional branch with 2 successors");
// Look up the branch condition to get the corresponding VPValue
// representing the condition bit in VPlan (which may be in another VPBB).
Expand Down
1 change: 0 additions & 1 deletion mlir/lib/Analysis/Presburger/Simplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ Simplex::Unknown &SimplexBase::unknownFromRow(unsigned row) {
unsigned SimplexBase::addZeroRow(bool makeRestricted) {
// Resize the tableau to accommodate the extra row.
unsigned newRow = tableau.appendExtraRow();
assert(getNumRows() == getNumRows() && "Inconsistent tableau size");
rowUnknown.emplace_back(~con.size());
con.emplace_back(Orientation::Row, makeRestricted, newRow);
undoLog.emplace_back(UndoLogEntry::RemoveLastConstraint);
Expand Down
12 changes: 6 additions & 6 deletions mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,11 +778,11 @@ FailureOr<bool>
ValueBoundsConstraintSet::areOverlappingSlices(MLIRContext *ctx,
HyperrectangularSlice slice1,
HyperrectangularSlice slice2) {
assert(slice1.getMixedOffsets().size() == slice1.getMixedOffsets().size() &&
assert(slice1.getMixedOffsets().size() == slice2.getMixedOffsets().size() &&
"expected slices of same rank");
assert(slice1.getMixedSizes().size() == slice1.getMixedSizes().size() &&
assert(slice1.getMixedSizes().size() == slice2.getMixedSizes().size() &&
"expected slices of same rank");
assert(slice1.getMixedStrides().size() == slice1.getMixedStrides().size() &&
assert(slice1.getMixedStrides().size() == slice2.getMixedStrides().size() &&
"expected slices of same rank");

Builder b(ctx);
Expand Down Expand Up @@ -843,11 +843,11 @@ FailureOr<bool>
ValueBoundsConstraintSet::areEquivalentSlices(MLIRContext *ctx,
HyperrectangularSlice slice1,
HyperrectangularSlice slice2) {
assert(slice1.getMixedOffsets().size() == slice1.getMixedOffsets().size() &&
assert(slice1.getMixedOffsets().size() == slice2.getMixedOffsets().size() &&
"expected slices of same rank");
assert(slice1.getMixedSizes().size() == slice1.getMixedSizes().size() &&
assert(slice1.getMixedSizes().size() == slice2.getMixedSizes().size() &&
"expected slices of same rank");
assert(slice1.getMixedStrides().size() == slice1.getMixedStrides().size() &&
assert(slice1.getMixedStrides().size() == slice2.getMixedStrides().size() &&
"expected slices of same rank");

// The two slices are equivalent if all of their offsets, sizes and strides
Expand Down
Loading