Skip to content
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

Migrate to the new LLVM pass manager #252

Closed
wants to merge 1 commit into from

Conversation

tetsuo-cpp
Copy link
Contributor

Closes #130

@tetsuo-cpp tetsuo-cpp marked this pull request as draft August 19, 2021 13:18
@tetsuo-cpp
Copy link
Contributor Author

The unit tests seem ok but if I run anvill-decompile, I'm seeing some ASan failures.

mpm.addPass(llvm::GlobalDCEPass());
// TODO(alex): Figure out what to do here.
// The new version of this pass only seems to have been added in LLVM 12.
// mpm.addPass(llvm::StripDeadDebugInfoPass());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pass was introduced in this commit. It'd be pretty easy to just write the wrapper ourselves if we wanted.

fpm.addPass(llvm::SimplifyCFGPass());
// TODO(alex): It doesn't seem to like this and complains about the pass not being registered.
// Perhaps it's because we're nesting pass managers?
// fpm.addPass(llvm::InstCombinePass());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This thing where we do another series of passes in a nested way seems to be causing a bit of trouble.

fpm.add(llvm::createSROAPass());
fpm.add(CreateSplitStackFrameAtReturnAddress(err_man));
fpm.add(llvm::createSROAPass());
AddSinkSelectionsIntoBranchTargets(fpm, err_man);
Copy link
Contributor Author

@tetsuo-cpp tetsuo-cpp Aug 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new pass manager doesn't take a pointer anymore. So if I want to do:

fpm.add(SinkSelectionsIntoBranchTargets(err_man))

Then I'd need to expose the headers for each of the passes and move them to libraries/anvill_passes/include since we need the actual definitions to construct it. To avoid reorganising everything, I've exposed these helpers in Transform.h to add the pass to the pass manager.

@tetsuo-cpp
Copy link
Contributor Author

Closing in favour of #264

@tetsuo-cpp tetsuo-cpp closed this Oct 25, 2021
@tetsuo-cpp tetsuo-cpp deleted the llvm-new-pass-manager branch October 25, 2021 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrating to the new LLVM pass manager
1 participant