[llvm-dev] [RFC] Expressing preserved-relations between passes from different modules

Finkel, Hal J. via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 6 08:06:39 PDT 2019

On 6/6/19 3:27 AM, Nicolai Hähnle-Montoro via llvm-dev wrote:
> Any comments at all on this? Chandler perhaps?
> I've since dug a bit further, and it seems like the template-based
> solution wouldn't work anyway because DLL loading on Windows can't do
> the required commoning. So the general approach taken in
> https://reviews.llvm.org/D62802 seems to be the only technically
> viable path forward, though it would still be good to get an outside
> look at the concrete details.
> Thanks,
> Nicolai
> On Mon, Jun 3, 2019 at 10:35 AM Nicolai Hähnle-Montoro
> <nhaehnle at gmail.com> wrote:
>> Hi all,
>> re-upping and renaming this thread to get some attention, as we'd like
>> some feedback on a change that affects the future design direction.
>> The concrete problem: We would like to mark the LCSSA pass as
>> preserving the StackProtector pass in order to be able to properly
>> express all dependencies we have. Unfortunately, those passes are
>> defined in different modules that do not (and should not) depend on
>> each other, which causes linking to fail.

You say "should not", but I'm not sure that's clear. If LCSSA has 
knowledge of the StackProtector, then there is a legitimate dependence. 
Either we express that directly, or alternatively, we abstract the 
relevant properties to create an abstract dependence. For example, we 
have the setPreservesCFG/CFGOnly property pair. In general, I think that 
we should have more of these abstract properties. That having been said, 
if the orthogonality is very specific, then a specific dependence may be 


>> Our proposal is to introduce a collection of cross-module pass IDs in
>> the core module (lib/IR) to work around such issues. This is done by
>> the RFC patch at https://reviews.llvm.org/D62802.
>> The only potential alternative I can see would be to generate the IDs
>> using some kind of template magic and then rely on (runtime) linker
>> magic to common the generated symbols. That feels like a bit too much
>> magic for a fundamentally simple problem to me, hence the more
>> low-tech proposal in the linked Phabricator review.
>> Please let us know your thoughts!
>> Thanks,
>> Nicolai
>> On Tue, May 14, 2019 at 3:55 PM Ryan Taylor via llvm-dev
>> <llvm-dev at lists.llvm.org> wrote:
>>> Some background: We have an issue with in loop values being correctly marked uniform but the out of loop uses can be non-uniform. Currently the out of loop users are not marked as divergent because the in loop value is uniform inside the loop. We have gotten around this problem for the moment by applying LCSSA which inserts a PHI in the loop exit for the in loop uniform value that allows the divergent info to be passed onto isel.
>>> The LCSSA is being inserted into XXXDAGToDAGISel class but this causes a pass scheduling conflict with StackProtector. So what we've done is try to preserve StackProtector in LCSSA, the issue is that the linker fails in Debug build (but not Release build).
>>> StackProtector lies in CodeGen while LCSSA lies in Tranforms/Utils.
>>> Matt had mentioned to me that you can't refer to a preserved pass if it's not on the same library and that it might make sense to move the transform IDs into a separate library. We need a way to mark transforms/analyses as preserved without depending on linking the transform itself.
>>> Thanks,
>>> Ryan
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> llvm-dev at lists.llvm.org
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>> --
>> Lerne, wie die Welt wirklich ist,
>> aber vergiss niemals, wie sie sein sollte.
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

More information about the llvm-dev mailing list