We use MemorySanitizer in a JIT setting where we run all of our functions through a function pass manager to apply some of our own lowering passes before passing everything off to MCJIT. I tried adding MemorySanitizer to this setup, but the current implementation assumes that all functions MemorySanitizer will run on belong to the same module. Address this by reinitializing MemorySanitizer if the passed function is in a different module and looking or creating the correct globals in that module.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Transforms/Instrumentation/MemorySanitizer.cpp | ||
---|---|---|
370 | Do we need to reinit C as well? What about things like DataLayout, TargetTriple (I'm looking at MemorySanitizer::doInitialization) etc? Where do we stop? Perhaps it would be cleaner to detect the change of ModuleID and reinit everything? |
lib/Transforms/Instrumentation/MemorySanitizer.cpp | ||
---|---|---|
370 | Hmm, I'm not sure. This was the only changes I needed to make it work for my use case, which is a single FunctionPassManager running over all my Functions independent of which module they're in. That works fine for every pass but msan, but perhaps somebody more familiar with the pass manager can chime in here what the actual expectation for a function pass is. |
Do we need to reinit C as well? What about things like DataLayout, TargetTriple (I'm looking at MemorySanitizer::doInitialization) etc? Where do we stop?
Perhaps it would be cleaner to detect the change of ModuleID and reinit everything?