[PATCH] D135137: [AggressiveInstCombine] Load merge the reverse load pattern of consecutive loads.
Evgeny Eltsin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 1 12:06:13 PDT 2022
eaeltsin added a comment.
Here is the reproducer - https://godbolt.org/z/7bcjzfYK4
The following program returns 33 on trunk and 0 on clang 14:
#include <utility>
template <typename ValueType>
class Cell {
public:
Cell() = default;
void Set(ValueType value) {
value_ = value;
has_data_ = true;
}
std::pair<ValueType, bool> GetAndMarkRead() {
bool fresh = has_data_;
has_data_ = false;
return std::make_pair(value_, fresh);
}
bool GetAndMarkRead2() {
bool fresh = has_data_;
has_data_ = false;
return fresh;
}
ValueType value_;
bool has_data_ = false;
};
bool foo() {
Cell<bool> cell;
cell.Set(true);
return cell.GetAndMarkRead().second;
}
int main() {
if (foo()) return 0;
return 33;
}
`GetAndMarkRead` returns `false` instead of 'true`. Returning `std::pair` matters.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135137/new/
https://reviews.llvm.org/D135137
More information about the llvm-commits
mailing list