via llvm-dev
2018-Jan-16 23:16 UTC
[llvm-dev] Running Scalar Evolution on Modules on an ad-hoc basis
Hello! I am attempting to write a program which can analyze multiple llvm modules. Specifically, I want to use scalar evolution on different modules while being able to refer to the results across all modules thus processed. Ideally I don't want to do it as an LTO pass -- I don't know which modules I need to check at the time the program starts running. My current attempt at an MVP is attached. However, it segfaults on line 41. My suspicion is that the prerequisite passes that ScalarEvolution relies on aren't being run, but I could be entirely mistaken on this. Can anyone give me a pointer toward how to do this correctly? Thank you! Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180116/1a427530/attachment.html> -------------- next part -------------- (gdb) r Starting program: /home/ebdavis/Documents/llvm-build/bin/dfsan-scev-parse if.bc [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". I: %0 = load i32, i32* getelementptr inbounds ([64 x i32], [64 x i32]* @__dfsan_arg_tls, i64 0, i64 2), !dbg !18 SCEV: Program received signal SIGSEGV, Segmentation fault. llvm::DenseMap<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*> >::getBuckets (this=0x78) at /home/ebdavis/Documents/llvm-project/llvm/include/llvm/ADT/DenseMap.h:739 739 return Buckets; (gdb) bt #0 llvm::DenseMap<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*> >::getBuckets (this=0x78) at /home/ebdavis/Documents/llvm-project/llvm/include/llvm/ADT/DenseMap.h:739 #1 0x00000000009b1a45 in llvm::DenseMapBase<llvm::DenseMap<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*> >, llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*> >::getBuckets (this=0x78) at /home/ebdavis/Documents/llvm-project/llvm/include/llvm/ADT/DenseMap.h:441 #2 0x00000000009b1cda in llvm::DenseMapBase<llvm::DenseMap<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*> >, llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*> >::LookupBucketFor<llvm::Value*> (this=0x78, Val=@0x7fffffffd508: 0xda5a68, FoundBucket=@0x7fffffffd410: 0x0) at /home/ebdavis/Documents/llvm-project/llvm/include/llvm/ADT/DenseMap.h:534 #3 0x00000000009b1ba8 in llvm::DenseMapBase<llvm::DenseMap<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*> >, llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*> >::LookupBucketFor<llvm::Value*> (this=0x78, Val=@0x7fffffffd508: 0xda5a68, FoundBucket=@0x7fffffffd468: 0x100000000da5910) at /home/ebdavis/Documents/llvm-project/llvm/include/llvm/ADT/DenseMap.h:586 #4 0x000000000098dc06 in llvm::DenseMapBase<llvm::DenseMap<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*> >, llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*> >::find_as<llvm::Value*> (this=0x78, Val=@0x7fffffffd508: 0xda5a68) at /home/ebdavis/Documents/llvm-project/llvm/include/llvm/ADT/DenseMap.h:152 #5 0x0000000000958242 in llvm::ScalarEvolution::getExistingSCEV (this=0x0, V=0xda5a68) at /home/ebdavis/Documents/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:3705 #6 0x0000000000953b67 in llvm::ScalarEvolution::getSCEV (this=0x0, V=0xda5a68) at /home/ebdavis/Documents/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:3673 #7 0x000000000065a5f6 in main (argc=2, argv=0x7fffffffda98) at /home/ebdavis/Documents/llvm-project/compiler-rt/lib/dfsan/dfsan_scev_parser/multi_module_pass.cpp:53 -------------- next part -------------- A non-text attachment was scrubbed... Name: multi_module_pass.cpp Type: text/x-c Size: 1194 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180116/1a427530/attachment.bin>