Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miscompile with -loop-rotate -indvars #3016

Closed
llvmbot opened this issue Aug 6, 2008 · 4 comments
Closed

miscompile with -loop-rotate -indvars #3016

llvmbot opened this issue Aug 6, 2008 · 4 comments
Labels
bugzilla Issues migrated from bugzilla invalid Resolved as invalid, i.e. not a bug loopoptim

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 6, 2008

Bugzilla Link 2644
Resolution INVALID
Resolved on Oct 26, 2008 19:17
Version trunk
OS Linux
Attachments testcase; the part that gets miscompiled, driver for the testcase; used to generate 'x.s' in the snippet
Reporter LLVM Bugzilla Contributor

Extended Description

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).

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 15, 2008

Nick,

What are the exact steps to reproduce this bug ? Thanks.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 15, 2008

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!

@lattner
Copy link
Collaborator

lattner commented Oct 16, 2008

Still an issue?

@nlewycky
Copy link
Contributor

Nope.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
vfdff added a commit to vfdff/llvm-project that referenced this issue Dec 5, 2023
When all the large const offsets masked with the same value from bit-12 to bit-23.
Fold
  add     x8, x0, llvm#2031, lsl llvm#12
  add     x8, x8, llvm#960
  ldr     x9, [x8, x8]
  ldr     x8, [x8, llvm#2056]

into
  add     x8, x0, llvm#2031, lsl llvm#12
  ldr     x9, [x8, llvm#960]
  ldr     x8, [x8, llvm#3016]
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla invalid Resolved as invalid, i.e. not a bug loopoptim
Projects
None yet
Development

No branches or pull requests

3 participants