[PATCH] D142535: [DAGCombine] Fold redundant select
Bogdan Graur via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 8 08:27:33 PST 2023
bgraur added a comment.
Thanks a lot for reverting!
Here's the repro:
#include <vector>
[[clang::noinline]] int Miscompile(const std::vector<int>& l) {
struct Dummy{int x;};
std::vector<Dummy> d;
for (int i = 0; i < l.size(); ++i)
d.push_back({l[i]});
constexpr int kMax = 10;
if (d.size() > kMax)
d.resize(kMax);
return d.size();
}
int main(int argc, char** argv) {
return Miscompile(std::vector<int>());
}
Compilation command:
clang -O3 -fno-exceptions -fsized-deallocation -o /tmp/miscompile miscompile.cc -lc++
The resulting binary will exit with 10 while a correct compiler should exit 0.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142535/new/
https://reviews.llvm.org/D142535
More information about the llvm-commits
mailing list