Skip to content

[HashRecognize] Don't const-qualify Values in result #144752

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

Merged
merged 1 commit into from
Jun 18, 2025
Merged
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
12 changes: 6 additions & 6 deletions llvm/include/llvm/Analysis/HashRecognize.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,27 @@ struct PolynomialInfo {
// division in the case of CRC. Since polynomial division is an XOR in
// GF(2^m), this variable must be XOR'ed with RHS in a loop to yield the
// ComputedValue.
const Value *LHS;
Value *LHS;

// The generating polynomial, or the RHS of the polynomial division in the
// case of CRC.
APInt RHS;

// The final computed value. This is a remainder of a polynomial division in
// the case of CRC, which must be zero.
const Value *ComputedValue;
Value *ComputedValue;

// Set to true in the case of big-endian.
bool ByteOrderSwapped;

// An optional auxiliary checksum that augments the LHS. In the case of CRC,
// it is XOR'ed with the LHS, so that the computation's final remainder is
// zero.
const Value *LHSAux;
Value *LHSAux;

PolynomialInfo(unsigned TripCount, const Value *LHS, const APInt &RHS,
const Value *ComputedValue, bool ByteOrderSwapped,
const Value *LHSAux = nullptr);
PolynomialInfo(unsigned TripCount, Value *LHS, const APInt &RHS,
Value *ComputedValue, bool ByteOrderSwapped,
Value *LHSAux = nullptr);
};

/// The analysis.
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/Analysis/HashRecognize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,9 @@ getRecurrences(BasicBlock *LoopLatch, const PHINode *IndVar, const Loop &L) {
return std::make_pair(SimpleRecurrence, ConditionalRecurrence);
}

PolynomialInfo::PolynomialInfo(unsigned TripCount, const Value *LHS,
const APInt &RHS, const Value *ComputedValue,
bool ByteOrderSwapped, const Value *LHSAux)
PolynomialInfo::PolynomialInfo(unsigned TripCount, Value *LHS, const APInt &RHS,
Value *ComputedValue, bool ByteOrderSwapped,
Value *LHSAux)
: TripCount(TripCount), LHS(LHS), RHS(RHS), ComputedValue(ComputedValue),
ByteOrderSwapped(ByteOrderSwapped), LHSAux(LHSAux) {}

Expand Down Expand Up @@ -623,7 +623,7 @@ HashRecognize::recognizeCRC() const {
if (!checkExtractBits(ResultBits, TC, IsZero, *ByteOrderSwapped))
return ErrBits(ResultBits, TC, *ByteOrderSwapped);

const Value *LHSAux = SimpleRecurrence ? SimpleRecurrence.Start : nullptr;
Value *LHSAux = SimpleRecurrence ? SimpleRecurrence.Start : nullptr;
return PolynomialInfo(TC, ConditionalRecurrence.Start, GenPoly, ComputedValue,
*ByteOrderSwapped, LHSAux);
}
Expand Down
Loading