valida-xyz / valida-compiler

Old, obsolete version of the Valida compiler; its replacement will become public later
Other
50 stars 12 forks source link

Segmentation fault when attempting to generate assembly #10

Open sai-deng opened 1 year ago

sai-deng commented 1 year ago

./build/bin/llc fib.ll --march=valida --global-isel Pass 'IRTranslator' is not initialized. Verify if there is a pass dependency cycle. Required Passes: Insert stack protectors Target Pass Configuration PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump:

  1. Program arguments: ./build/bin/llc fib.ll --march=valida --global-isel Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it): 0 llc 0x00000001035ac644 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56 1 llc 0x00000001035aa9f0 llvm::sys::RunSignalHandlers() + 112 2 llc 0x00000001035ace24 SignalHandler(int) + 352 3 libsystem_platform.dylib 0x0000000183771a24 _sigtramp + 56 4 llc 0x00000001030036b8 llvm::PMTopLevelManager::schedulePass(llvm::Pass) + 2876 5 llc 0x0000000102e2ff24 llvm::TargetPassConfig::addPass(llvm::Pass) + 660 6 llc 0x00000001027b8594 (anonymous namespace)::ValidaPassConfig::addIRTranslator() + 48 7 llc 0x0000000102e30b44 llvm::TargetPassConfig::addCoreISelPasses() + 460 8 llc 0x0000000102e30d6c llvm::TargetPassConfig::addISelPasses() + 272 9 llc 0x0000000102bbac88 llvm::LLVMTargetMachine::addPassesToEmitFile(llvm::legacy::PassManagerBase&, llvm::raw_pwrite_stream&, llvm::raw_pwrite_stream, llvm::CodeGenFileType, bool, llvm::MachineModuleInfoWrapperPass) + 180 10 llc 0x00000001027a1f24 main + 7456 11 dyld 0x00000001833c9058 start + 2224 zsh: segmentation fault ./build/bin/llc fib.ll --march=valida --global-isel

When attempting to generate assembly using the llc tool for the valida target on a MacBook with an M2 chip, it results in a crash.

vivekvpandya commented 1 year ago

valida.patch.txt This attached patch fixes this particular issue, however I still run into other crash

vivek@vivek-System-Product-Name:~/dev$ ./valida-compiler/build/bin/llc fib.ll -march=valida --global-isel
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: ./valida-compiler/build/bin/llc fib.ll -march=valida --global-isel
1.      Running pass 'Function Pass Manager' on module 'fib.ll'.
2.      Running pass 'InstructionSelect' on function '@fib'
 #0 0x000055d9a2332d56 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./valida-compiler/build/bin/llc+0x12dfd56)
 #1 0x000055d9a23305be SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f9e3d642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000055d9a13f3c65 (anonymous namespace)::ValidaInstructionSelector::selectStore(llvm::MachineInstr&) const ValidaInstructionSelector.cpp:0:0
 #4 0x000055d9a13f59d5 (anonymous namespace)::ValidaInstructionSelector::select(llvm::MachineInstr&) ValidaInstructionSelector.cpp:0:0

Looks like selectStore is not working correctly.