[llvm-dev] Need guidance to work on NEW PASS managers bugs

Kaylor, Andrew via llvm-dev llvm-dev at lists.llvm.org
Tue May 1 14:05:24 PDT 2018


The opt-bisect facility is pretty simple. Essentially, you just need an interface function that gets call from a pass and returns true or false based on a counter that gets incremented whenever the function is called.

In the current implementation (with the legacy pass manager) there is an OptBisector object owned by the LLVMContext that does this. Each of the legacy pass base classes has a skip routine (skipFunction, skipLoop, skipBasicBlock, etc.) which provides a default implementation of the code to get a reference to the OptBisector and call one of its shouldRunPass() routines.

An important aspect of the current implementation is that the skip functions for any IR unit at the function level or below also checks for the presence of the “optnone” function attribute if the OptBisector does not indicate that the pass run should be skipped.

For the new pass manager, we’ll probably want to do something similar. I don’t have a polished design in mind, but just off the cuff I’m imagining something like a template shouldRunPass that takes an IR unit argument and uses it to get the LLVM context and check for the “optnone” attribute if applicable. This could possibly live in the Pass.

The OptPassGate interface used by the OptBisector requires an IR unit and a Pass pointer, but it only uses these to construct a description of the pass run for output. That can be changed if necessary. My initial prototype of the OptBisect function (which you can find here https://reviews.llvm.org/D18576) had support for the new pass manager. The pass manager driven approach in that patch was abandoned, but the OptBisect interface itself was substantially similar to what we ended up with. The patch is almost certainly stale, but it could provide some useful ideas.

With regard to the code generation passes, that’s a pretty big project and not one that I would recommend attempting if you aren’t sure where to start. Until that work has been done, whatever happens with the opt bisect support for the new pass manager should be designed to work in conjunction with the opt bisect support for the legacy pass manager so that the same counter is used for both.

-Andy

From: vivek pandya [mailto:vivekvpandya at gmail.com]
Sent: Tuesday, May 01, 2018 12:01 PM
To: Kaylor, Andrew <andrew.kaylor at intel.com>
Cc: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] Need guidance to work on NEW PASS managers bugs



On Tue, May 1, 2018 at 10:52 PM, Kaylor, Andrew <andrew.kaylor at intel.com<mailto:andrew.kaylor at intel.com>> wrote:
Hi Vivek,

Have you read the mailing list threads on this topic? I don’t believe we’re quite ready to make the switch yet. There was a discussion last October about what was left to be done. I’m sure it has been discussed since then too. Here’s a link to the start of the October discussion.

http://lists.llvm.org/pipermail/llvm-dev/2017-October/118280.html
Yes I have gone through that mail chain. One thing mentioned in that was Code Generation does not use new PM so I wanted to start working in that direction.

If you’d like to get involved, one possible area you could contribute is adding optbisect/optnone support as mentioned in this bug:

https://bugs.llvm.org/show_bug.cgi?id=28316

If that looks like something you’re interested in I can offer some guidance with it.
Sure I am happy to work on it. Could you please update the bug with your thoughts on how that needs to be done?

-Vivek

Thanks,
Andy

From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org<mailto:llvm-dev-bounces at lists.llvm.org>] On Behalf Of vivek pandya via llvm-dev
Sent: Saturday, April 28, 2018 9:23 AM
To: llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>>
Subject: [llvm-dev] Need guidance to work on NEW PASS managers bugs

Hello LLVM-Devs,

I am trying to get some starting points for working on following new pass manager related bugs:

https://bugs.llvm.org/show_bug.cgi?id=28322 [PM] Remove use of old PM in the middle-end.

https://bugs.llvm.org/show_bug.cgi?id=28323 [PM] Use new PM in production for Clang, LLD, libLTO, etc. middle-end
https://bugs.llvm.org/show_bug.cgi?id=28321 [PM] Remove use of old PM in the backend

I read related code but did not get a good starting point.
Can someone guide me through this? Can we add more details to these bugs? Or can we further divide these bugs to smaller workable items?

Any help will be appreciated.

Thanks,
Vivek

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180501/46f11b87/attachment.html>


More information about the llvm-dev mailing list