lac-dcc / Daedalus

Daedalus is an LLVM pass that compresses code by identifying and extracting recurrent program slices.
GNU General Public License v3.0
21 stars 1 forks source link

Fail to execute the pass with opt #12

Open hxm-cpp opened 1 month ago

hxm-cpp commented 1 month ago

running: /x/llvm17-merge-functions/llvm/build/bin/opt -load-pass-plugin /x/Daedalus/cmake-build-relwithdebinfo/lib/libdaedalus.dylib -passes=daedalus -debug-pass-manager -S -o opt.ll soupertest.ll

results on:


Running analysis: InnerAnalysisManagerProxy<FunctionAnalysisManager, Module> on [module]
Assertion failed: (AnalysisPasses.count(PassT::ID()) && "This analysis pass was not registered prior to being queried"), function getResult, file PassManager.h, line 776.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.  Program arguments: /x/llvm17-merge-functions/llvm/build/bin/opt -load-pass-plugin /x/Daedalus/cmake-build-relwithdebinfo/lib/libdaedalus.dylib -passes=daedalus -debug-pass-manager -S -o opt.ll soupertest.ll
 #0 0x0000000103e57e4c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/x/llvm17-merge-functions/llvm/build/bin/opt+0x101b57e4c)
 #1 0x0000000103e56108 llvm::sys::RunSignalHandlers() (/x/llvm17-merge-functions/llvm/build/bin/opt+0x101b56108)
 #2 0x0000000103e585c0 SignalHandler(int) (/x/llvm17-merge-functions/llvm/build/bin/opt+0x101b585c0)
 #3 0x0000000197164184 (/usr/lib/system/libsystem_platform.dylib+0x180484184)
 #4 0x000000019712ef70 (/usr/lib/system/libsystem_pthread.dylib+0x18044ef70)
 #5 0x000000019703b908 (/usr/lib/system/libsystem_c.dylib+0x18035b908)
 #6 0x000000019703ac1c (/usr/lib/system/libsystem_c.dylib+0x18035ac1c)
 #7 0x000000010beb8054 llvm::PassInstrumentationAnalysis::Result& llvm::AnalysisManager<llvm::Module>::getResult<llvm::PassInstrumentationAnalysis>(llvm::Module&) (.cold.2) (/x/Daedalus/cmake-build-relwithdebinfo/lib/libdaedalus.dylib+0x630054)
 #8 0x000000010ba68fec llvm::AnalysisManager<llvm::Module>::getCachedResultImpl(llvm::AnalysisKey*, llvm::Module&) const (/x/Daedalus/cmake-build-relwithdebinfo/lib/libdaedalus.dylib+0x1e0fec)
 #9 0x000000010ba6b7a8 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/x/Daedalus/cmake-build-relwithdebinfo/lib/libdaedalus.dylib+0x1e37a8)
#10 0x000000010b8ab86c llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/x/Daedalus/cmake-build-relwithdebinfo/lib/libdaedalus.dylib+0x2386c)
#11 0x000000010368c2c4 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/x/llvm17-merge-functions/llvm/build/bin/opt+0x10138c2c4)
#12 0x0000000102308360 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (/x/llvm17-merge-functions/llvm/build/bin/opt+0x100008360)
#13 0x0000000102316e04 main (/x/llvm17-merge-functions/llvm/build/bin/opt+0x100016e04)
#14 0x0000000196dac274
[1]    15341 abort      /x/llvm17-merge-functions/llvm/build/bin/opt     -S -o

ll is attached. soupertest.ll.zip

DanielAugusto191 commented 1 month ago

Hello, thank you for your report. I took a look at your example and saw that you are using an architecture that I can’t test at the moment. Most tests so far have been conducted on x86_64, and using Linux (Arch, Ubuntu, and Debian). Apparently, you tested on macOS, and probably on an M2 arch, right? At first, I’m not sure if it’s an architecture-related issue, but I’d like to check. Would you be able to try it on Linux or provide a source file before converting to LLVM IR so I can perform additional tests?