Created attachment 1896 [details] testcase; the part that gets miscompiled I have a miscompile: $ opt -loop-rotate -indvars c.bc | llc -f -o x2.s nlewycky@ducttape:~/local$ gcc x.s x2.s -o x -lm nlewycky@ducttape:~/local$ ./x Hilbert Slice. Test case 1 of size 120. One-Norm(A) ---------- 1.833333e+00. Segmentation fault Without the 'opt' phase, the program runs correctly. This is a bugpoint reduction of sgefa. I should mention that opt -loop-rotate | opt -indvars appears to produce different output (it's hard to spot amongst the variable renamings, but it looks like a GEP is missing or in a different spot).
Created attachment 1897 [details] driver for the testcase; used to generate 'x.s' in the snippet
Nick, What are the exact steps to reproduce this bug ? Thanks.
Hi Devang, On Linux it looks like this: $ opt -loop-rotate -indvars c.bc | llc -f -o c.s $ llc bugpoint-tonotoptimize.bc -f -o d.s $ gcc c.s d.s -o sgefa $ gcc c.s d.s -o sgefa -lm $ ./sgefa Hilbert Slice. Test case 1 of size 120. One-Norm(A) ---------- 1.833333e+00. Segmentation fault but I wouldn't be surprised if it didn't work on OSX because of llvm-gcc baked-in headers and what-not. If you want to go back to the original testcase, visit MultiSource/Applications/sgefa, and run: bugpoint Output/sgefa.noopt-llvm.bc -mem2reg -instcombine -simplifycfg -loop-rotate -indvars -append-exit-code -rel-tolerance 0.0001 -Xlinker=-lm -input=/dev/null -output=Output/sgefa.out-nat -timeout=500 --tool-args --args -- That should do it!
Still an issue?
Nope.