[PATCH] D105020: [SLP]Improve graph reordering.
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 14 07:43:54 PDT 2021
ABataev added a comment.
In D105020#3064191 <https://reviews.llvm.org/D105020#3064191>, @goncharov wrote:
> Hi @ABataev ,
>
> I have found another regression on the latest version of this change:
>
> > cat repro.cc
> #include <cstdio>
> struct a {
> int b;
> int c;
> int o;
> int d;
> };
> class e {
> public:
> e(int);
> void f(a *);
> int g;
> int h;
> int i;
> };
> void e::f(a *p) {
> fprintf(stderr, "MiscompiledFunction\n");
> fprintf(stderr, "%d, %d, %d, %d, %d, %d\n", p->b, p->c, p->o, p->d, h, g);
> int j = (p->b + p->c) / 2, k = (p->o + p->d) / 2, l, m;
> switch (i) {
> case 0:
> case 2:
> l = h - 1 - j;
> m = g - 1 - k;
> }
> p->b = l + p->b - j;
> p->c = l + p->c - j;
> p->o = m + p->o - k;
> p->d = m + p->d - k;
> }
> int n = 0;
> e::e(int q) : g(0), h(0), i(q) {}
> int main() {
> a *bb = new a{0, 9, 4, 0}, *p = bb;
> e r(n);
> r.f(p);
> printf("%d %d %d %d\n", bb->b, bb->c, bb->o, bb->d);
> }
> > # at 5661317f864abf750cf893c6a4cc7a977be0995a
> > clang -Wall -Werror -Wextra -O3 -fno-exceptions -stdlib=libc++ -lc++ -std=gnu++17 repro.cc && ./a.out
> -9 0 -1 -5
> > # at bc69dd62c04a70d29943c1c06c7effed150b70e1
> > clang -Wall -Werror -Wextra -O3 -fno-exceptions -stdlib=libc++ -lc++ -std=gnu++17 repro.cc && ./a.out
> -7 2 -3 -7
>
> It's quite fragile as e.g. removing `fprintf(stderr, "MiscompiledFunction\n");` or running with -fsanitize=null "fixes" the output.
I'll check it, thanks!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105020/new/
https://reviews.llvm.org/D105020
More information about the llvm-commits
mailing list