[llvm] f13b9e3 - [HashRecognize] Don't const-qualify Values in result (#144752)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 18 12:18:56 PDT 2025
Author: Ramkumar Ramachandra
Date: 2025-06-18T20:18:53+01:00
New Revision: f13b9e3643661ea2cda252c7e2c59ace036407c7
URL: https://github.com/llvm/llvm-project/commit/f13b9e3643661ea2cda252c7e2c59ace036407c7
DIFF: https://github.com/llvm/llvm-project/commit/f13b9e3643661ea2cda252c7e2c59ace036407c7.diff
LOG: [HashRecognize] Don't const-qualify Values in result (#144752)
Const-qualifying Values in the analysis result makes them unusable with
IRBuilder. The issue was discovered when attempting to use the result of
the analysis for a transform.
Added:
Modified:
llvm/include/llvm/Analysis/HashRecognize.h
llvm/lib/Analysis/HashRecognize.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/HashRecognize.h b/llvm/include/llvm/Analysis/HashRecognize.h
index 8ab68a5dc2cb1..c169383bf7b08 100644
--- a/llvm/include/llvm/Analysis/HashRecognize.h
+++ b/llvm/include/llvm/Analysis/HashRecognize.h
@@ -53,7 +53,7 @@ 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.
@@ -61,7 +61,7 @@ struct PolynomialInfo {
// 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;
@@ -69,11 +69,11 @@ struct PolynomialInfo {
// 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.
diff --git a/llvm/lib/Analysis/HashRecognize.cpp b/llvm/lib/Analysis/HashRecognize.cpp
index 987d13731276e..06a3738018e9c 100644
--- a/llvm/lib/Analysis/HashRecognize.cpp
+++ b/llvm/lib/Analysis/HashRecognize.cpp
@@ -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) {}
@@ -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);
}
More information about the llvm-commits
mailing list