Run StackSafetyAnalysis at the end of the IR pipeline and annotate
proven safe allocas with !stack-safe metadata. Do not instrument such
allocas in the AArch64StackTagging pass.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
To explain some design decisions:
The analysis is added to the IR pipeline and not to the AArch64 codegen pipeline mainly because we plan to extend it with ThinLTO support in the future. To do that, module summary builder will need to depend on the (function-)local stack safety analysis pass, and the global analysis result will be provided by the combined summary reader, and all of that must happen in the target-independent IR pipeline.
Another reason is that the legacy pass manager, which is still used for codegen, is not good at mixing function and module analyses. AFAIK a module pass that depends on function analysis will always produce an on-the-fly pass manager which can not reuse earlier analysis results; and a function pass can not depend on a module analysis at all (at least I could not make it work).
For these two reasons I opted not to use analysis manager framework to pass the safety information to AArch64StackTaggingPass, and chose to use alloca metadata instead.
Unit tests: pass. 62250 tests passed, 0 failed and 816 were skipped.
clang-tidy: fail. clang-tidy found 0 errors and 1 warnings. 0 of them are added as review comments below (why?).
clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
llvm/lib/Analysis/StackSafetyAnalysis.cpp | ||
---|---|---|
670 | Could you please add basic test in StackSafetyAnalysis to checks "stack-safe" in IR? |
Could you please add basic test in StackSafetyAnalysis to checks "stack-safe" in IR?