Skip to content

decouple llvm types from zig types #2135

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

Merged
merged 15 commits into from
Apr 3, 2019
Merged

decouple llvm types from zig types #2135

merged 15 commits into from
Apr 3, 2019

Conversation

andrewrk
Copy link
Member

@andrewrk andrewrk commented Mar 29, 2019

This closes #761, and lays the groundwork for fixing the remaining
false positive "foo depends on itself" bugs, such as #624.

It also lays the groundwork for implementing ability to specify
alignment of fields (#1512).

I started trying to fix even more alignment problems, including removing a dirty hack that master branch has in there for when a struct depends on its own alignment in what should be a harmless way, which required introducing Lazy Values in 3dc8448. I realized this was going to be taking on way too much in an already large branch, so I backed out the Lazy Values change in d3f2fe2 and put the master branch hack back in in d7bc763. Lazy Values will have to be a later commit.

Once this passes all tests and is merged, I'll go through the bugs and see which ones we can solve with this. Unfortunately some of them will have to remain until Lazy Values is in.

This branch also fixes a soundness issue with packed structs. Previously Zig was aligning packed struct fields based on byte-alignment; however according to the LLVM semantics we needed it to be aligned to the ABI alignment of the host integer type.

@emekoi
Copy link
Contributor

emekoi commented Mar 30, 2019

will this help with #1814 as well?

andrewrk added 12 commits April 2, 2019 18:31
Not tested yet, but it builds.

This closes #761, and lays the groundwork for fixing the remaining
false positive "foo depends on itself" bugs, such as #624.

It also lays the groundwork for implementing ability to specify
alignment of fields (#1512).
but I think it's a bad idea, so I'm going to back out the change
let's try to keep this branch to solving one problem at a time
@andrewrk andrewrk force-pushed the decouple-llvm-types branch from 87d7ba7 to e9dc504 Compare April 2, 2019 22:31
@andrewrk andrewrk marked this pull request as ready for review April 2, 2019 23:09
@andrewrk
Copy link
Member Author

andrewrk commented Apr 2, 2019

will this help with #1814 as well?

Probably not.

fixes llvm assertion when building for windows
@andrewrk andrewrk merged commit 85edf55 into master Apr 3, 2019
@andrewrk andrewrk deleted the decouple-llvm-types branch April 3, 2019 03:17
@andrewrk
Copy link
Member Author

andrewrk commented Apr 3, 2019

This brought a tiny performance improvement:

master branch, behavior tests:
                Name       Start         End    Duration     Percent
          Initialize      0.0000      0.0011      0.0011      0.0005
   Semantic Analysis      0.0011      0.3586      0.3575      0.1554
     Code Generation      0.3586      0.4272      0.0686      0.0298
    LLVM Emit Output      0.4272      2.2918      1.8647      0.8108
  Build Dependencies      2.2918      2.2927      0.0009      0.0004
           LLVM Link      2.2927      2.2997      0.0070      0.0030
               Total      0.0000      2.2997      2.2997      1.0000
master branch, std lib tests:
                Name       Start         End    Duration     Percent
          Initialize      0.0000      0.0008      0.0008      0.0000
   Semantic Analysis      0.0008      1.6472      1.6464      0.0948
     Code Generation      1.6472      2.2861      0.6388      0.0368
    LLVM Emit Output      2.2861     17.3504     15.0644      0.8670
  Build Dependencies     17.3504     17.3513      0.0008      0.0000
           LLVM Link     17.3513     17.3750      0.0238      0.0014
               Total      0.0000     17.3750     17.3750      1.0000

decouple-llvm-types, behavior tests:
                Name       Start         End    Duration     Percent
          Initialize      0.0000      0.0016      0.0016      0.0007
   Semantic Analysis      0.0016      0.3428      0.3411      0.1506
     Code Generation      0.3428      0.4174      0.0747      0.0330
    LLVM Emit Output      0.4174      2.2540      1.8366      0.8109
  Build Dependencies      2.2540      2.2550      0.0010      0.0004
           LLVM Link      2.2550      2.2648      0.0098      0.0043
               Total      0.0000      2.2648      2.2648      1.0000
decouple-llvm-types, std lib tests:
                Name       Start         End    Duration     Percent
          Initialize      0.0000      0.0010      0.0010      0.0001
   Semantic Analysis      0.0010      1.4236      1.4226      0.0831
     Code Generation      1.4236      2.0888      0.6652      0.0388
    LLVM Emit Output      2.0888     17.1039     15.0151      0.8767
  Build Dependencies     17.1039     17.1046      0.0007      0.0000
           LLVM Link     17.1046     17.1265      0.0220      0.0013
               Total      0.0000     17.1265     17.1265      1.0000

You can see the Semantic Analysis got faster and Code Generation got slower. This makes sense because LLVM types are now created in the Code Generation phase rather than the Semantic Analysis phase.

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.

invalid debug info types passed to LLVM sometimes
2 participants