https://llvm.org/bugs/show_bug.cgi?id=31554
Bug ID: 31554 Summary: NewGVN miscompile Product: libraries Version: trunk Hardware: PC OS: Windows NT Status: NEW Severity: normal Priority: P Component: Scalar Optimizations Assignee: unassignedb...@nondot.org Reporter: greg_bedw...@sn.scee.net CC: llvm-bugs@lists.llvm.org Blocks: 30995 Classification: Unclassified Found a bad runtime result with -enable-newgvn on one of our test suites. I'm currently out of the office until mid-next-week so haven't had a chance to look in-depth at the codegen to see if it's a duplicate of an existing report against NewGVN, but I figured it would be better to raise it now than in a week's time as I have a nice self-contained test-case already. $./build/bin/clang --version clang version 4.0.0 (trunk 291148) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /home/greg/public_git/./build/bin $./build/bin/clang -O2 1.cpp -o 1.elf && ./1.elf loop A: CC[0] <- AA[0] (10) loop B: CC[1] <- BB[0] (20) loop B: CC[2] <- BB[1] (21) loop B: CC[3] <- BB[2] (22) loop B: CC[4] <- BB[3] (23) loop B: CC[5] <- BB[4] (24) loop B: CC[6] <- BB[5] (25) loop B: CC[7] <- BB[6] (26) 10, 20, 21, 22, 23, 24, 25, 26 $./build/bin/clang -O2 -mllvm -enable-newgvn 1.cpp -o 1.elf && ./1.elf loop A: CC[0] <- AA[0] (10) loop B: CC[1] <- BB[0] (20) loop B: CC[2] <- BB[1] (21) loop B: CC[3] <- BB[2] (22) loop B: CC[4] <- BB[3] (23) loop B: CC[5] <- BB[4] (24) loop B: CC[6] <- BB[5] (25) loop B: CC[7] <- BB[6] (26) 0, 20, 21, 22, 23, 24, 25, 26 ^~~~~ should be 10 // ============================================================================ extern "C" int printf(const char *, ...); typedef char __attribute__((vector_size(8))) vec8; vec8 foo(unsigned mask) { vec8 AA = (vec8){10, 11, 12, 13, 14, 15, 16, 17}; vec8 BB = (vec8){20, 21, 22, 23, 24, 25, 26, 27}; vec8 CC; if (mask == 0) return BB; int idxA = 0; for (; idxA < mask; ++idxA, --mask) { int a = idxA; int b = mask - 1; int c = AA[b]; printf("loop A: CC[%d] <- AA[%d] (%d)\n", a, b, c); CC[a] = c; } for (int idxB = 0; idxA < 8; ++idxA, ++idxB) { int a = idxA; int b = idxB; int c = BB[b]; printf("loop B: CC[%d] <- BB[%d] (%d)\n", a, b, c); CC[a] = c; } return CC; } int main() { vec8 r = foo(1); printf("%d, %d, %d, %d, %d, %d, %d, %d\n", r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7]); } // ============================================================================ -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs