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

Handle named references in structs correctly #90

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jcpetruzza
Copy link
Contributor

The added test-case would previously fail since:

; ModuleID = 'simple module'

%struct.coord2d = type {i32, i32}
%struct.vector = type {%struct.coord2d, %struct.coord2d}

@up = global %struct.vector {%struct.coord2d {i32 0, i32 0}, %struct.coord2d {i32 0, i32 1}}

would get pretty-printed as invalid code:

; ModuleID = 'simple module'

%struct.coord2d = type {i32, i32}
%struct.vector = type {%struct.coord2d, %struct.coord2d}

@up = global %struct.vector {%struct.coord2d zeroinitializer, {i32 0, i32 0} {i32 0, i32 1}}

To run the tests, I had to update the nix support, that had bitrot

It was no longer possible to run the tests using
nix-shell as instructed in the README. There were
several issues:

  - default.nix had outdated dependencies
  - default.nix had `doCheck` set to false, which
    meant that the test dependencies (tasty, etc)
    wouldn't show up in the derivation and would
    not be installed.
  - haskell deps are to be found in `(propagated}buildInputs`
  - the pinned version of nixpkgs was very old, and
    prettyprinter was not available there
  - stdenv.lib was deprecated long ago and it is no longer
    available in recent versions of nixpkgs

Because of the last point, running nix-shell would effectively
only install ghc and cabal-install, and cabal would to build
llvm-hs, which is needed only for running the tests.

With the above fixed, running nix-shell would try to build
llvm-hs and llvm-hs-pure and fail: the default.nix files
there have also bitrot, have missing dependencies, etc.

Because llvm-hs and llvm-hs-pure are available in
nixpkgs now, we can rely on those versions instead. I'm
leaving the support for running versions from source, which
can be useful at some point once they are fixed upstream.
The added test-case would previously fail since:

```
; ModuleID = 'simple module'

%struct.coord2d = type {i32, i32}
%struct.vector = type {%struct.coord2d, %struct.coord2d}

@up = global %struct.vector {%struct.coord2d {i32 0, i32 0}, %struct.coord2d {i32 0, i32 1}}
```

would get pretty-printed as invalid code:

```
; ModuleID = 'simple module'

%struct.coord2d = type {i32, i32}
%struct.vector = type {%struct.coord2d, %struct.coord2d}

@up = global %struct.vector {%struct.coord2d zeroinitializer, {i32 0, i32 0} {i32 0, i32 1}}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant