-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[CodeGen] Port ShadowStackGCLowering
to new pass manager
#75324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6ee5ff5
to
32bfbb0
Compare
Ping @arsenm |
@@ -170,7 +212,7 @@ Type *ShadowStackGCLowering::GetConcreteStackEntryType(Function &F) { | |||
|
|||
/// doInitialization - If this module uses the GC intrinsics, find them now. If | |||
/// not, exit fast. | |||
bool ShadowStackGCLowering::doInitialization(Module &M) { | |||
bool ShadowStackGCLoweringImpl::doInitialization(Module &M) { | |||
bool Active = false; | |||
for (Function &F : M) { | |||
if (F.hasGC() && F.getGC() == std::string("shadow-stack")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
existing issue but this doesn't need the std::string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
6ba3523
to
3892562
Compare
3892562
to
d81ecd3
Compare
IIUC the new pass system was designed with parallelism. This pass needs to add some global variables into the current module, this is not allowed by [WritingAnLLVMPass](https://llvm.org/docs/WritingAnLLVMPass.html#the-functionpass-class), so convert it to module pass, see FIXME in `GetFrameMap`. Therefore, this will trigger assertion in `CodeGenPassBuilder`: https://github.com/llvm/llvm-project/blob/effd47ed45e3badd756103346a7c3b9e1e939e5e/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h#L200-L207 Will fix it in future.
@@ -26,6 +26,7 @@ MODULE_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis, (PIC)) | |||
MODULE_PASS("pre-isel-intrinsic-lowering", PreISelIntrinsicLoweringPass, ()) | |||
MODULE_PASS("jmc-instrumenter", JMCInstrumenterPass, ()) | |||
MODULE_PASS("lower-emutls", LowerEmuTLSPass, ()) | |||
MODULE_PASS("shadow-stack-gc-lowering", ShadowStackGCLoweringPass, ()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not missing anything, this doesn't seem to do anything because the registration actually happens from PassRegistry.def
?
Related: #76320 (comment)
Is the idea to separate the codegen module passes from optimization passes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the code here does nothing. Will delete them when call back style pass builder is approved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks!
IIUC the new pass system was designed with parallelism. This pass needs to add some global variables into the current module, this is not allowed by
WritingAnLLVMPass, so convert it to module pass, see FIXME in
GetFrameMap
.Therefore, this will trigger assertion in
CodeGenPassBuilder
:llvm-project/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h
Lines 200 to 207 in effd47e