Implement -femit-local-var-lifetime which adds local (stack) variable… (#4395)

Implement -femit-local-var-lifetime which adds local (stack) variable lifetime annotation to LLVM IR, which enables sharing stack space for variables whose lifetimes do not overlap.
Resolves issue #2227

This is not enabled by default yet, to prevent miscompilation due to bugs (should be enabled in future for optimization levels > 0, and when sanitizers are enabled).
This commit is contained in:
Johan Engelen 2023-06-02 00:45:56 +02:00 committed by GitHub
parent 89cbc4cceb
commit ef0719f36b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 357 additions and 6 deletions

View file

@ -203,8 +203,10 @@ static void legacyAddGarbageCollect2StackPass(const PassManagerBuilder &builder,
}
static void legacyAddAddressSanitizerPasses(const PassManagerBuilder &Builder,
PassManagerBase &PM) {
PM.add(createAddressSanitizerFunctionPass());
PassManagerBase &PM) {
PM.add(createAddressSanitizerFunctionPass(/*CompileKernel = */ false,
/*Recover = */ false,
/*UseAfterScope = */ true));
PM.add(createModuleAddressSanitizerLegacyPassPass());
}