LLC fail without gccld optimization on spec2000 int benchmarks

Hi,

In my experiments, I need to disable several linking optimizations. However, bzip2, vortex and eon failed if “-disable-opt” was passed to gccld. I tried the out-of-box llvm and the building process provided by llvm-test. The same problem was observed, when I specified EXTRA_LINKTIME_OPT_FLAGS = -disable-opt on Makefile.program and simplied typed “make” under llvm-test/External/SPEC/CINT2000. Seems that these errors come from llc backend. But I have to stick to x86 backend because otherwise I can not control the optimization passes that gcc will put on the generated c code.

I am wondering if this problem is a llc bug or some implicit rules. I really appreciate if it is solved.

Thanks,
Jing

==============error messages for vortex:=================
/home/snir/jingyu/resources/llvm/build2/Debug/bin/gccas Output/255.vortex.linked.rll -o Output/255.vortex.linked.bc
/home/snir/jingyu/resources/llvm/build2/Debug/bin/gccld -L/home/snir/jingyu/resources/llvm/cfrontend/x86/llvm-gcc/bin/…/lib/gcc/i686-pc-linux-gnu/3.4-llvm -L/home/snir/jingyu/resources/llvm/cfrontend/x86/llvm-gcc/bin/…/lib Output/255.vortex.linked.bc
-disable-opt -lc -lpthread -lltdl -lm -lcrtend -o Output/255.vortex.llvm
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc -f Output/255.vortex.llvm.bc -o Output/255.vortex.llc.s
llc: /home/snir/jingyu/resources/llvm/build2/…/llvm2/llvm/lib/Target/X86/X86ISelLowering.cpp:2405: virtual llvm::SDOperand llvm::X86TargetLowering::LowerOperation(llvm::SDOperand, llvm::SelectionDAG&): Assertion `isFP && “Illegal integer SetCC!”’ failed./home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous namespace)::PrintStackTrace()+0x1a)[0x87a818e]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous namespace)::SignalHandler(int)+0xe9)[0x87a841d]
/lib/tls/libc.so.6[0x420277b8]
/lib/tls/libc.so.6(abort+0x1d5)[0x42028c55]
/lib/tls/libc.so.6[0x42021043]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::X86TargetLowering::LowerOperation(llvm::SDOperand, llvm::SelectionDAG&)+0x26c5)[0x83fe515]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDOperand)+0xa318)[0x851262c]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous namespace)::SelectionDAGLegalize::PromoteOp(llvm::SDOperand)+0x3030)[0x851c3cc]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous namespace)::SelectionDAGLegalize::HandleOp(llvm::SDOperand)+0xa9)[0x85080bf]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous namespace)::SelectionDAGLegalize::LegalizeDAG()+0x236)[0x8507a4e]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::SelectionDAG::Legalize()+0x48)[0x852848c]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::SelectionDAGISel::CodeGenAndEmitDAG(llvm::SelectionDAG&)+0x75)[0x854f957]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::SelectionDAGISel::SelectBasicBlock(llvm::BasicBlock*, llvm::MachineFunction&, llvm::FunctionLoweringInfo&)+0xd8)[0x854fb1e]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::SelectionDAGISel::runOnFunction(llvm::Function&)+0x2cd)[0x854e111]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous namespace)::X86DAGToDAGISel::runOnFunction(llvm::Function&)+0x25)[0x84ea18b]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::FunctionPassManagerT::runPass(llvm::FunctionPass*, llvm::Function*)+0x1f)[0x86e004b]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::PassManagerTllvm::FTraits::runPasses(llvm::Function*, std::map<llvm::Pass*, std::vector<llvm::Pass*, std::allocatorllvm::Pass* >, std::lessllvm::Pass*, std::allocator<std::pair<llvm::Pass*
const, std::vector<llvm::Pass*, std::allocatorllvm::Pass* > > > >&)+0x13e)[0x86de7e0]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::PassManagerTllvm::FTraits::runOnUnit(llvm::Function*)+0x17b)[0x86de667]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::FunctionPassManagerT::runOnFunction(llvm::Function&)+0x25)[0x86e00e9]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::FunctionPass::runOnModule(llvm::Module&)+0xa5)[0x867420f]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::ModulePassManager::runPass(llvm::ModulePass*, llvm::Module*)+0x1f)[0x86e1c11]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::PassManagerTllvm::MTraits::runPasses(llvm::Module*, std::map<llvm::Pass*, std::vector<llvm::Pass*, std::allocatorllvm::Pass* >, std::lessllvm::Pass*, std::allocator<std::pair<llvm::Pass* const, std::vector<llvm::Pass*, std::allocatorllvm::Pass* > > > >&)+0x13e)[0x86e0a4e]/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::PassManagerTllvm::MTraits::runOnUnit(llvm::Module*)+0x17b)[0x86e08d5]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::ModulePassManager::runOnModule(llvm::Module&)+0x25)[0x867329d]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::PassManager::run(llvm::Module&)+0x23)[0x867362d]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(main+0xd67)[0x83c589b]
/lib/tls/libc.so.6(__libc_start_main+0xe4)[0x42015704]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(dlopen+0x45)[0x83c49a1]
make[1]: *** [Output/255.vortex.llc.s] Aborted (core dumped)

==========error messages for bzip2:===========

gcc Output/256.bzip2.llc.s -lm -lm -o Output/256.bzip2.llc
/home/snir/jingyu/resources/llvm/llvm2/llvm/projects/llvm-test/External/SPEC/Sandbox.sh llc-train Output/256.bzip2.out-llc /home/snir/jingyu/resources/llvm/build2/projects/llvm-test/External/speccpu2000/benchspec/CINT2000/256.bzip2/data/train/input/
/home/snir/jingyu/resources/llvm/llvm2/llvm/projects/llvm-test/RunSafely.sh 500 /dev/null input.compressed.out
…/256.bzip2.llc cat /home/snir/jingyu/resources/llvm/build2/projects/llvm-test/External/speccpu2000/benchspec/CINT2000/256.bzip2/data/train/input/control
Running: /home/snir/jingyu/resources/llvm/llvm2/llvm/projects/llvm-test/RunSafely.sh
500 /dev/null input.compressed.out …/256.bzip2.llc input.compressed 8
(cd Output/llc-train; cat input.compressed.out) > Output/256.bzip2.out-llc
cp Output/llc-train/input.compressed.out.time Output/256.bzip2.out-llc.time
/home/snir/jingyu/resources/llvm/llvm2/llvm/projects/llvm-test/DiffOutput.sh "/home/snir/jingyu/resources/llvm/build2/Debug/bin/fpcmp " llc 256.bzip2
/home/snir/jingyu/resources/llvm/build2/Debug/bin/fpcmp: Comparison failed, not a numeric difference.
******************** TEST (llc) ‘256.bzip2’ FAILED! ********************
Execution Context Diff:
******************** TEST (llc) ‘256.bzip2’ ****************************

========error messages for eon============

Running: /home/snir/jingyu/resources/llvm/llvm2/llvm/projects/llvm-test/RunSafely.sh 500 /dev/null cook_log.out /home/snir/jingyu/resources/llvm/build2/Debug/bin/lli -force-interpreter=false …/252.eon.llvm.bc chair.control.cook chair.camera chair.surfaces chair.cook.ppm ppm pixels_out.cook
Core was generated by /home/snir/jingyu/resources/llvm/build2/Debug/bin/lli -force-interpreter=false'. Program terminated with signal 11, Segmentation fault. #0 0x4055c292 in ?? () #0 0x4055c292 in ?? () #1 0x405500c8 in ?? () #2 0x0846fb12 in llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*, std::vector<std::string, std::allocator<std::string> > const&, char const* const*) (this=0x8e00ae0, Fn=0x8a0c378, argv=@0x890fe5c, envp=0xbfffe35c) at /home/snir/jingyu/resources/llvm/build2/../llvm2/llvm/lib/ExecutionEngine/ExecutionEngine.cpp:154 #3 0x083ba550 in main (argc=9, argv=0xbfffe334, envp=0xbfffe35c) at /home/snir/jingyu/resources/llvm/build2/../llvm2/llvm/tools/lli/lli.cpp:105 #4 0x42015704 in __libc_start_main () from /lib/tls/libc.so.6 (cd Output/jit-train; cat pixels_out.cook pixels_out.kajiya pixels_out.rushmeier) > Output/252.eon.out-jit cat: pixels_out.cook: No such file or directory cat: pixels_out.kajiya: No such file or directory cat: pixels_out.rushmeier: No such file or directory make[1]: [Output/252.eon.out-jit] Error 1 (ignored) cp Output/jit-train/cook_log.out.time Output/252.eon.out-jit.time /home/snir/jingyu/resources/llvm/llvm2/llvm/projects/llvm-test/DiffOutput.sh "/home/snir/jingyu/resources/llvm/build2/Debug/bin/fpcmp -a 0.005" jit 252.eon ******************** TEST (jit) '252.eon' FAILED! ******************** Execution Context Diff: ******************** TEST (jit) '252.eon' **************************** make[1]: Leaving directory /home/snir/jingyu/resources/llvm/build2/projects/llvm-test/External/SPEC/CINT2000/252.eon’

In my experiments, I need to disable several linking optimizations. However,
bzip2, vortex and eon failed if "-disable-opt" was passed to gccld. I tried
the out-of-box llvm and the building process provided by llvm-test. The same
problem was observed, when I specified EXTRA_LINKTIME_OPT_FLAGS =
-disable-opt on Makefile.program and simplied typed "make" under
llvm-test/External/SPEC/CINT2000. Seems that these errors come from llc
backend. But I have to stick to x86 backend because otherwise I can not
control the optimization passes that gcc will put on the generated c code.

I am wondering if this problem is a llc bug or some implicit rules. I really
appreciate if it is solved.

This looks like an LLVM bug. The best way for us to figure out what the problem is would be for you to follow the instructions on this page:

http://llvm.org/docs/HowToSubmitABug.html

Given that, the fix for the bug is probably straight-forward.

Thanks!

-Chris

==============error messages for vortex:=================
/home/snir/jingyu/resources/llvm/build2/Debug/bin/gccas
Output/255.vortex.linked.rll -o Output/255.vortex.linked.bc
/home/snir/jingyu/resources/llvm/build2/Debug/bin/gccld
-L/home/snir/jingyu/resources/llvm/cfrontend/x86/llvm-gcc/bin/../lib/gcc/i686-pc-linux-gnu/3.4-llvm
-L/home/snir/jingyu/resources/llvm/cfrontend/x86/llvm-gcc/bin/../lib
Output/255.vortex.linked.bc
-disable-opt -lc -lpthread -lltdl -lm -lcrtend -o Output/255.vortex.llvm
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc -f
Output/255.vortex.llvm.bc -o Output/255.vortex.llc.s
llc:
/home/snir/jingyu/resources/llvm/build2/../llvm2/llvm/lib/Target/X86/X86ISelLowering.cpp:2405:
virtual llvm::SDOperand
llvm::X86TargetLowering::LowerOperation(llvm::SDOperand,
llvm::SelectionDAG&): Assertion `isFP && "Illegal integer SetCC!"'
failed./home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous
namespace)::PrintStackTrace()+0x1a)[0x87a818e]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous
namespace)::SignalHandler(int)+0xe9)[0x87a841d]
/lib/tls/libc.so.6[0x420277b8]
/lib/tls/libc.so.6(abort+0x1d5)[0x42028c55]
/lib/tls/libc.so.6[0x42021043]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::X86TargetLowering::LowerOperation(llvm::SDOperand,
llvm::SelectionDAG&)+0x26c5)[0x83fe515]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous
namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDOperand)+0xa318)[0x851262c]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous
namespace)::SelectionDAGLegalize::PromoteOp(llvm::SDOperand)+0x3030)[0x851c3cc]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous
namespace)::SelectionDAGLegalize::HandleOp(llvm::SDOperand)+0xa9)[0x85080bf]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous
namespace)::SelectionDAGLegalize::LegalizeDAG()+0x236)[0x8507a4e]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::SelectionDAG::Legalize()+0x48)[0x852848c]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::SelectionDAGISel::CodeGenAndEmitDAG(llvm::SelectionDAG&)+0x75)[0x854f957]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::SelectionDAGISel::SelectBasicBlock(llvm::BasicBlock*,
llvm::MachineFunction&, llvm::FunctionLoweringInfo&)+0xd8)[0x854fb1e]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::SelectionDAGISel::runOnFunction(llvm::Function&)+0x2cd)[0x854e111]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc((anonymous
namespace)::X86DAGToDAGISel::runOnFunction(llvm::Function&)+0x25)[0x84ea18b]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::FunctionPassManagerT::runPass(llvm::FunctionPass*,
llvm::Function*)+0x1f)[0x86e004b]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::PassManagerT<llvm::FTraits>::runPasses(llvm::Function*,
std::map<llvm::Pass*, std::vector<llvm::Pass*, std::allocator<llvm::Pass*>

, std::less<llvm::Pass*>, std::allocator<std::pair<llvm::Pass*

const, std::vector<llvm::Pass*, std::allocator<llvm::Pass*> > > >

&)+0x13e)[0x86de7e0]

/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::PassManagerT<llvm::FTraits>::runOnUnit(llvm::Function*)+0x17b)[0x86de667]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::FunctionPassManagerT::runOnFunction(llvm::Function&)+0x25)[0x86e00e9]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::FunctionPass::runOnModule(llvm::Module&)+0xa5)[0x867420f]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::ModulePassManager::runPass(llvm::ModulePass*,
llvm::Module*)+0x1f)[0x86e1c11]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::PassManagerT<llvm::MTraits>::runPasses(llvm::Module*,
std::map<llvm::Pass*, std::vector<llvm::Pass*, std::allocator<llvm::Pass*>

, std::less<llvm::Pass*>, std::allocator<std::pair<llvm::Pass* const,

std::vector<llvm::Pass*, std::allocator<llvm::Pass*> > > >

&)+0x13e)[0x86e0a4e]/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::PassManagerT<llvm::MTraits>::runOnUnit(llvm::Module*)+0x17b)[0x86e08d5]

/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::ModulePassManager::runOnModule(llvm::Module&)+0x25)[0x867329d]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(llvm::PassManager::run(llvm::Module&)+0x23)[0x867362d]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(main+0xd67)[0x83c589b]
/lib/tls/libc.so.6(__libc_start_main+0xe4)[0x42015704]
/home/snir/jingyu/resources/llvm/build2/Debug/bin/llc(dlopen+0x45)[0x83c49a1]
make[1]: *** [Output/255.vortex.llc.s] Aborted (core dumped)

==========error messages for bzip2:===========
...
gcc Output/256.bzip2.llc.s -lm -lm -o Output/256.bzip2.llc
/home/snir/jingyu/resources/llvm/llvm2/llvm/projects/llvm-test/External/SPEC/Sandbox.sh
llc-train Output/256.bzip2.out-llc
/home/snir/jingyu/resources/llvm/build2/projects/llvm-test/External/speccpu2000/benchspec/CINT2000/256.bzip2/data/train/input/
\

/home/snir/jingyu/resources/llvm/llvm2/llvm/projects/llvm-test/RunSafely.sh
500 /dev/null input.compressed.out \
                 ../256.bzip2.llc `cat
/home/snir/jingyu/resources/llvm/build2/projects/llvm-test/External/speccpu2000/benchspec/CINT2000/256.bzip2/data/train/input/control`
Running:
/home/snir/jingyu/resources/llvm/llvm2/llvm/projects/llvm-test/RunSafely.sh
500 /dev/null input.compressed.out ../256.bzip2.llc input.compressed 8
(cd Output/llc-train; cat input.compressed.out) > Output/256.bzip2.out-llc
cp Output/llc-train/input.compressed.out.time Output/256.bzip2.out-llc.time
/home/snir/jingyu/resources/llvm/llvm2/llvm/projects/llvm-test/DiffOutput.sh
"/home/snir/jingyu/resources/llvm/build2/Debug/bin/fpcmp " llc 256.bzip2
/home/snir/jingyu/resources/llvm/build2/Debug/bin/fpcmp: Comparison failed,
not a numeric difference.
******************** TEST (llc) '256.bzip2' FAILED! ********************
Execution Context Diff:
******************** TEST (llc) '256.bzip2' ****************************

========error messages for eon============
...
Running:
/home/snir/jingyu/resources/llvm/llvm2/llvm/projects/llvm-test/RunSafely.sh
500 /dev/null cook_log.out
/home/snir/jingyu/resources/llvm/build2/Debug/bin/lli
-force-interpreter=false ../252.eon.llvm.bc chair.control.cook chair.camera
chair.surfaces chair.cook.ppm ppm pixels_out.cook
Core was generated by `/home/snir/jingyu/resources/llvm/build2/Debug/bin/lli
-force-interpreter=false'.
Program terminated with signal 11, Segmentation fault.
#0 0x4055c292 in ?? ()
#1 0x405500c8 in ?? ()
#2 0x0846fb12 in llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*,
std::vector<std::string, std::allocator<std::string> > const&, char const*
const*)
   (this=0x8e00ae0, Fn=0x8a0c378, argv=@0x890fe5c, envp=0xbfffe35c)
   at
/home/snir/jingyu/resources/llvm/build2/../llvm2/llvm/lib/ExecutionEngine/ExecutionEngine.cpp:154
#3 0x083ba550 in main (argc=9, argv=0xbfffe334, envp=0xbfffe35c)
   at
/home/snir/jingyu/resources/llvm/build2/../llvm2/llvm/tools/lli/lli.cpp:105
#4 0x42015704 in __libc_start_main () from /lib/tls/libc.so.6
(cd Output/jit-train; cat pixels_out.cook pixels_out.kajiya
pixels_out.rushmeier) > Output/252.eon.out-jit
cat: pixels_out.cook: No such file or directory
cat: pixels_out.kajiya: No such file or directory
cat: pixels_out.rushmeier: No such file or directory
make[1]: [Output/252.eon.out-jit] Error 1 (ignored)
cp Output/jit-train/cook_log.out.time Output/252.eon.out-jit.time
/home/snir/jingyu/resources/llvm/llvm2/llvm/projects/llvm-test/DiffOutput.sh
"/home/snir/jingyu/resources/llvm/build2/Debug/bin/fpcmp -a 0.005" jit
252.eon
******************** TEST (jit) '252.eon' FAILED! ********************
Execution Context Diff:
******************** TEST (jit) '252.eon' ****************************
make[1]: Leaving directory
`/home/snir/jingyu/resources/llvm/build2/projects/llvm-test/External/SPEC/CINT2000/252.eon'

-Chris