Closed llvmbot closed 16 years ago
Stefan, if a symbol is used only in assembly, it should be given the used attribute (see gcc docs) so that it will not be removed as dead by llvm.
Try marking the symbols that are only used in asm code with the used attribute and see if your problems resolve themselves.
Alternately, they are marked internal by -internalize, and internalize has an option to select symbols not to internalize, which would also prevent them from being dead and thus eliminated.
I can't reproduce this, so presumably it is fixed in svn.
llvm-gcc -v Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../llvm-gcc4.2-2.2.source/configure --prefix=/home/stefan/ParExC/code/LLVM/../usr --disable-shared --program-prefix=llvm- --enable-llvm=/home/stefan/ParExC/code/LLVM/llvm-gcc4.2-2.2.build/../llvm-2.2 --enable-languages=c,c++ --disable-multilib Thread model: posix gcc version 4.2.1 (Based on Apple Inc. build 5546) (LLVM build 2.2)
It doesn't crash llc for me, but then again I am using llc from svn. Which version of LLVM are you using? Also, what platform are you on?
$ sh do.sh llc: SelectionDAG.cpp:476: void llvm::SelectionDAG::DeleteNode(llvm::SDNode*):
Great, but which .o file triggered it? Please attach that .o to this bug report. That way the bug can be solved without us downloading mplayer etc.
by the way:
stefan@ubuntu:~/MPlayer-1.0rc2/liba52$ llvm-nm liba52.a | grep sseSinCos1c d sseSinCos1c
so sseSinCos1c is still in the bitcode library, but "goes away" during linking.
sorry for so much comments - but i hope that may help.
in between i managed to compile mplayer - yeah :) as proposed in the irc i used -disable-opt and switched on all passes that llvm-ld uses when -disable-opt is not given. i the switched off different passes that i thought could be a reason - and that worked.
llvm-ld -native -O0 --disable-opt --disable-internalize --disable-inlining -o mplayer mplayer.o m_property.omp_fifo.o mp_msg.o mixer.o parser-mpcmd.o subopt-helper.o command.o asxparser.o codec-cfg.o cpudetect.o edl.o find_sub.o get_path.o m_config.o m_option.o m_struct.o mpcommon.o parser-cfg.o playtree.o playtreeparser.o spudec.o sub_cc.o subreader.o vobsub.o unrarlib.o libvo/libvo.a libao2/libao2.a input/libinput.a vidix/libvidix.a libmpcodecs/libmpcodecs.a libaf/libaf.a libmpdemux/libmpdemux.a stream/stream.a libswscale/libswscale.a libvo/libosd.a libavformat/libavformat.a libavcodec/libavcodec.a libavutil/libavutil.a libpostproc/libpostproc.a mp3lib/libmp3.a liba52/liba52.a libmpeg2/libmpeg2.a libfaad2/libfaad2.a tremor/libvorbisidec.a dvdread/libdvdread.a libdvdcss/libdvdcss.a libass/libass.a osdep/libosdep.a -lXext -lX11 -lXv -lXinerama -lXxf86vm -lXxf86dga -lGL -lggi -laa -lcaca -lcucul -lvga -lSDL -ldl -lartsc -lpthread -lgmodule-2.0 -ldl -lgthread-2.0 -lrt -lglib-2.0 -lesd -laudiofile -laudiofile -ljack -lopenal -lfaac -lx264 -lmp3lame -L/usr/lib -L/usr/lib -L/usr/lib -L/usr/lib -Xlinker=-z,noexecstack -lposix -lposix4 -lncurses -lsmbclient -lpng -lz -ljpeg -lungif -lasound -lcdda_interface -lcdda_paranoia -lfreetype -lz -lfontconfig -L/usr/lib -lfribidi -lenca -lz -llzo2 -lmad -lspeex -ltheora -logg -ldts -lmpcdec -ldv -lxvidcore -lm -Xlinker=-rdynamic -llirc_client -lm --debug-pass=Arguments -ipsccp -deadargelim -instcombine -basiccg -prune-eh -basiccg -argpromotion -domfrontier -scalarrepl -globalsmodref-aa -domtree -loops -loopsimplify -domfrontier -scalar-evolution-licm -memdep -gvn -dse -instcombine -simplifycfg -simplifycfg -dce -preverify -domtree -verify
the passes that are not "good" are: -constmerge -globalopt -globaldce
i guess the problem is, that some globals in mplayer are only used in assembly code - example:
definition: liba52/imdct.c:static float attribute((aligned(16))) sseSinCos1c[256];
the ONLY 2 uses: liba52/imdct.c: "movaps "MANGLE(sseSinCos1c)"(%%"REG_S"), %%xmm2\n\t" liba52/imdct.c: "mulps 1024+"MANGLE(sseSinCos1c)"(%%"REG_S"), %%xmm1\n\t"
with the "no-good" passes enabled, "sseSinCos1c" is one of the missing symbols.
they are passed as a string - so maybe the passes think, that they are unused and optimize them "away".
but this is just a guess, as i don't know enough about them.
shell script that runs llc on all files this is what happens - please note, that "*.o" files actually are not native binaries but bitcode files:
stefan@ubuntu:~/Downloads/MPlayer-1.0rc2$ sh do.sh llc: SelectionDAG.cpp:476: void llvm::SelectionDAG::DeleteNode(llvm::SDNode*): Assertion `N->use_empty() && "Cannot delete a node that is not dead!"' failed. llc[0x855210c] /lib/tls/i686/cmov/libc.so.6(abort+0x101)[0xb7d35a01] /lib/tls/i686/cmov/libc.so.6(__assert_fail+0xee)[0xb7d2d10e] llc[0x824bdb3] Aborted (core dumped)
Can you please do this: for each bitcode file x.bc run llc -fast x.bc I expect llc to crash on one of them. Please attach that bitcode file to this PR. Thanks!
i forgot to mention, that if i run llvm-ld without -disable-opt i do not get this error but then some symbols are missing
Extended Description
i want to compile mplayer with llvm. when i execute the following command: llvm-ld -native -O0 --disable-opt --disable-internalize --disable-inlining -o mplayer mplayer.o m_property.omp_fifo.o mp_msg.o mixer.o parser-mpcmd.o subopt-helper.o command.o asxparser.o codec-cfg.o cpudetect.o edl.o find_sub.o get_path.o m_config.o m_option.o m_struct.o mpcommon.o parser-cfg.o playtree.o playtreeparser.o spudec.o sub_cc.o subreader.o vobsub.o unrarlib.o libvo/libvo.a libao2/libao2.a input/libinput.a vidix/libvidix.a libmpcodecs/libmpcodecs.a libaf/libaf.a libmpdemux/libmpdemux.a stream/stream.a libswscale/libswscale.a libvo/libosd.a libavformat/libavformat.a libavcodec/libavcodec.a libavutil/libavutil.a libpostproc/libpostproc.a mp3lib/libmp3.a liba52/liba52.a libmpeg2/libmpeg2.a libfaad2/libfaad2.a tremor/libvorbisidec.a dvdread/libdvdread.a libdvdcss/libdvdcss.a libass/libass.a osdep/libosdep.a -lXext -lX11 -lXv -lXinerama -lXxf86vm -lXxf86dga -lGL -lggi -laa -lcaca -lcucul -lvga -lSDL -ldl -lartsc -lpthread -lgmodule-2.0 -ldl -lgthread-2.0 -lrt -lglib-2.0 -lesd -laudiofile -laudiofile -ljack -lopenal -lfaac -lx264 -lmp3lame -L/usr/lib -L/usr/lib -L/usr/lib -L/usr/lib -Xlinker=-z,noexecstack -lposix -lposix4 -lncurses -lsmbclient -lpng -lz -ljpeg -lungif -lasound -lcdda_interface -lcdda_paranoia -lfreetype -lz -lfontconfig -L/usr/lib -lfribidi -lenca -lz -llzo2 -lmad -lspeex -ltheora -logg -ldts -lmpcdec -ldv -lxvidcore -lm -Xlinker=-export-dynamic -llirc_client -lm
i get the following output
llc: SelectionDAG.cpp:476: void llvm::SelectionDAG::DeleteNode(llvm::SDNode*): Assertion `N->use_empty() && "Cannot delete a node that is not dead!"' failed. /home/stefan/workspace/ParExC/code/usr/bin/llc[0x855210c] /lib/tls/i686/cmov/libc.so.6(abort+0x101)[0xb7d30a01] /lib/tls/i686/cmov/libc.so.6(__assert_fail+0xee)[0xb7d2810e] /home/stefan/workspace/ParExC/code/usr/bin/llc[0x824bdb3] llvm-ld:
if you want to test that yourself, get mplayer-1.0 rc2. run "export CFLAGS="-emit-llvm -c" run "./configure --cc=llvm-gcc --as=as --ar=llvm-ar --ranlib=llvm-ranlib --disable-ssse3 --disable-sse --disable-sse2 --disable-mmx --disable-mmxext --disable-fastmemcpy --disable-shm --disable-3dnow --disable-3dnowext --disable-pthreads --disable-network --prefix=$HOME/workspace/ParExC/code/usr" run "make" it stops when trying to link mplayer
ignore that and execute the llvm-ld command from above