[llvm] [Attributor] Fix an issue that could potentially cause `AccessList` and `OffsetBins` out of sync (PR #106187)
Sameer Sahasrabuddhe via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 21:44:29 PDT 2024
================
@@ -5817,8 +5817,12 @@ struct AAPointerInfo : public AbstractAttribute {
/// Copy ranges from \p L that are not in \p R, into \p D.
static void set_difference(const RangeList &L, const RangeList &R,
RangeList &D) {
- std::set_difference(L.begin(), L.end(), R.begin(), R.end(),
- std::back_inserter(D), RangeTy::OffsetLessThan);
+ std::set_difference(
+ L.begin(), L.end(), R.begin(), R.end(), std::back_inserter(D),
+ [](const RangeTy &L, const RangeTy &R) {
+ return (L.Offset < R.Offset) ||
+ ((L.Offset == R.Offset) && (L.Size != R.Size));
----------------
ssahasra wrote:
std::set_difference() expects a "less than" comparison operator ... to that effect, this line needs to return `L.Size < R.Size`. Can we additionally just rename RangeTy::OffsetLessThan to RangeTy::LessThan, and then upgrade it by putting this entire check there?
https://github.com/llvm/llvm-project/pull/106187
More information about the llvm-commits
mailing list