[GHC] #7580: Building PrimOps.cmm on OS X with LLVM 3.2 fails
GHC
cvs-ghc at haskell.org
Mon Jan 14 07:41:16 CET 2013
#7580: Building PrimOps.cmm on OS X with LLVM 3.2 fails
--------------------------------+-------------------------------------------
Reporter: thoughtpolice | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler (LLVM)
Version: 7.7 | Keywords:
Os: MacOS X | Architecture: Unknown/Multiple
Failure: Building GHC failed | Blockedby:
Blocking: | Related: #7571, #7575
--------------------------------+-------------------------------------------
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 and #7575.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7580>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list