Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • 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,828
    • Issues 4,828
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 447
    • Merge requests 447
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #7580

Closed
Open
Created Jan 14, 2013 by thoughtpolice@trac-thoughtpolice

Building PrimOps.cmm on OS X with LLVM 3.2 fails

Using LLVM 3.2 (release,) or LLVM 3.3svn, on my Mac OS X 10.8 machine, the stage1 compiler fails to compile PrimOps.cmm with this error:

$ make
===--- building phase 0
make -r --no-print-directory -f ghc.mk phase=0 phase_0_builds
make[1]: Nothing to be done for `phase_0_builds'.
===--- building phase 1
make -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
make[1]: Nothing to be done for `phase_1_builds'.
===--- building final phase
make -r --no-print-directory -f ghc.mk phase=final all
"inplace/bin/ghc-stage1" -static -optc-DDEBUG  -H64m -O0 -fllvm -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -Irts -Irts/dist/build -DCOMPILING_RTS -package-name rts  -dcmm-lint  -DDTRACE     -i -irts -irts/dist/build -irts/dist/build/autogen -Irts/dist/build -Irts/dist/build/autogen            -O0    -c rts/PrimOps.cmm -o rts/dist/build/PrimOps.debug_o
/usr/local/bin/opt: /var/folders/f6/rjtvxfp92j3ffvm3zs7hv7vh0000gn/T/ghc99887_0/ghc99887_0.ll:6800:17: error: invalid cast opcode for cast from 'i64' to 'i64'
  %ln1N5 = zext i64 1 to i64

This seems to occur inside stg_retryzh, which looks like:

==================== LLVM Code ====================
define  cc 10 void @stg_retryzh(i64* noalias nocapture %Base_Arg, i64* noalias nocapture %Sp_Arg, i64* noalias nocapture %Hp_Arg, i64 %R1_Arg, i64 %R2_Arg, i64 %R3_Arg, i64 %R4_Arg, i64 %R5_Arg, i64 %R6_Arg, i64 %SpLim_Arg) align 8 nounwind
{
{
  ...
  ...
ccD:
  ...
  %ln1MS = call ccc i8* (i8*,i8*)* @stmStartTransaction( i8* %ln1MP, i8* %ln1MR ) nounwind
  %ln1MT = ptrtoint i8* %ln1MS to i64
  store i64 %ln1MT, i64* %lccV
  %ln1MU = load i64** %Base_Var
  %ln1MV = getelementptr inbounds i64* %ln1MU, i32 25
  %ln1MW = bitcast i64* %ln1MV to i64*
  %ln1MX = load i64* %ln1MW, !tbaa !4
  %ln1MY = add i64 %ln1MX, 8
  %ln1MZ = add i64 %ln1MY, 72
  %ln1N0 = load i64* %lccV
  %ln1N1 = inttoptr i64 %ln1MZ to i64*
  store i64 %ln1N0, i64* %ln1N1, !tbaa !5
  %ln1N2 = load i64* %lccU
  %ln1N3 = add i64 %ln1N2, 8
  %ln1N4 = add i64 %ln1N3, 0
  %ln1N5 = zext i64 1 to i64                <------ Invalid
  %ln1N6 = inttoptr i64 %ln1N4 to i64*
  store i64 %ln1N5, i64* %ln1N6, !tbaa !5
  %ln1N7 = load i64* %lccU
  %ln1N8 = add i64 %ln1N7, 8
  %ln1N9 = add i64 %ln1N8, 16
  %ln1Na = inttoptr i64 %ln1N9 to i64*
  %ln1Nb = load i64* %ln1Na, !tbaa !5
  store i64 %ln1Nb, i64* %R1_Var
  %ln1Nc = load i64** %Base_Var
  %ln1Nd = load i64** %Sp_Var
  %ln1Ne = load i64** %Hp_Var
  %ln1Nf = load i64* %R1_Var
  %ln1Ng = load i64* %SpLim_Var
  tail call cc 10 void (i64*,i64*,i64*,i64,i64,i64,i64,i64,i64,i64)* @stg_ap_v_fast( i64* %ln1Nc, i64* %ln1Nd, i64* %ln1Ne, i64 %ln1Nf, i64 undef, i
  ret void
  ...
  ...

Which would seem to correspond to this in PrimOps.cmm:

stg_retryzh /* no arg list: explicit stack layout */
{
  W_ frame_type;
  W_ frame;
  W_ trec;
  W_ outer;
  W_ r;
  ...
  ...
  (r) = ccall stmWait(MyCapability() "ptr", CurrentTSO "ptr", trec "ptr");
  if (r != 0) {
    ...
    ...
  } else {
    // Transaction was not valid: retry immediately
    ("ptr" trec) = ccall stmStartTransaction(MyCapability() "ptr", outer "ptr");
    StgTSO_trec(CurrentTSO) = trec;
    Sp = frame;
    R1 = StgAtomicallyFrame_code(frame);
    jump stg_ap_v_fast [R1];
  }
}

I'm still investigating. I think this is related to #7571 (closed) and #7575 (closed).

Trac metadata
Trac field Value
Version 7.7
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (LLVM)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC dterei, simonmar
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking