LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 2644 - miscompile with -loop-rotate -indvars
Summary: miscompile with -loop-rotate -indvars
Status: RESOLVED INVALID
Alias: None
Product: libraries
Classification: Unclassified
Component: Loop Optimizer (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-05 18:54 PDT by Nick Lewycky
Modified: 2008-10-26 19:17 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments
testcase; the part that gets miscompiled (1.54 KB, application/octet-stream)
2008-08-05 18:54 PDT, Nick Lewycky
Details
driver for the testcase; used to generate 'x.s' in the snippet (17.18 KB, application/octet-stream)
2008-08-05 18:55 PDT, Nick Lewycky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Lewycky 2008-08-05 18:54:12 PDT
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).
Comment 1 Nick Lewycky 2008-08-05 18:55:10 PDT
Created attachment 1897 [details]
driver for the testcase; used to generate 'x.s' in the snippet
Comment 2 Devang Patel 2008-08-14 17:36:44 PDT
Nick,

 What are the exact steps to reproduce this bug ? Thanks.
Comment 3 Nick Lewycky 2008-08-14 17:46:54 PDT
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!
Comment 4 Chris Lattner 2008-10-16 01:22:50 PDT
Still an issue?
Comment 5 Nick Lewycky 2008-10-26 19:17:59 PDT
Nope.