Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,869
    • Issues 4,869
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 456
    • Merge requests 456
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #16883
Closed
Open
Created Jun 28, 2019 by Stefan Schulze Frielinghaus@stefansfDeveloper

Intermediate LLVM files mangled up

Build GHC via LLVM backend fails if option -keep-llvm-files is present and multiple threads are used, i.e., make -j.

Compile GHC via ./boot && ./configure && make -j using the following build.mk file:

include mk/flavours/quick-llvm.mk
GhcStage2HcOpts += -keep-llvm-files
GhcLibHcOpts += -keep-llvm-files
GhcRtsHcOpts += -keep-llvm-files

results in the following error:

...
make[1]: *** [rts/ghc.mk:315: rts/dist/build/AutoApply.dyn_o] Error 1
make[1]: *** [rts/ghc.mk:315: rts/dist/build/AutoApply.l_o] Error 1
make[1]: *** [rts/ghc.mk:315: rts/dist/build/AutoApply.thr_l_dyn_o] Error 1
make[1]: *** [rts/ghc.mk:315: rts/dist/build/AutoApply.thr_o] Error 1
make[1]: *** [rts/ghc.mk:315: rts/dist/build/AutoApply.thr_dyn_o] Error 1
make[1]: *** [rts/ghc.mk:315: rts/dist/build/AutoApply.l_dyn_o] Error 1
opt: rts/dist/build/AutoApply.ll:20589:28: error: expected value token
  %ln4ve = mul i64 %ln4vd, g, i64* noalias nocapture %Sp_Arg, i64* noalias nocapture %Hp_Arg, i64 %R1_Arg, i64 %SpLim_Arg) align 8 nounwind
                           ^
`opt' failed in phase `LLVM Optimiser'. (Exit code: 1)
...

An excerpt of file rts/dist/build/AutoApply.ll looks as follows:

20583   tail call ghccc void (i64*, i64*, i64*, i64, i64) %ln4v7( i64* %Base_Arg, i64* %ln4v8, i64* %ln4v9, i64 %ln4va, i64 %SpLim_Arg ) nounwind
20584   ret void
20585 cBT:
20586   %ln4vb = load i64*, i64** %Sp_Var
20587   %ln4vc = ptrtoint i64* %ln4vb to i64
20588   %ln4vd = sub i64 0, 1
20589   %ln4ve = mul i64 %ln4vd, 8
20590   %ln4vf = add i64 %ln4vc, %ln4ve
20591   %ln4vg = inttoptr i64 %ln4vf to i64*
20592   store i64* %ln4vg, i64** %Sp_Var
20593   %ln4vh = load i64*, i64** %Sp_Var

For example, the function signature is messed up.

It looks like as if all builds of different ways of AutoApply are using the same intermediate LLVM file resulting in a race condition.

GHC release 8.6.5 (git 92b6a023) was used as stage0 compiler and as the actual target compiler.

Edited Jun 28, 2019 by Stefan Schulze Frielinghaus
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking