[NewPM] Provide method to run all pipeline callbacks, used for -O0
authorArthur Eubanks <aeubanks@google.com>
Fri, 30 Oct 2020 16:35:32 +0000 (09:35 -0700)
committerArthur Eubanks <aeubanks@google.com>
Thu, 5 Nov 2020 06:27:16 +0000 (22:27 -0800)
commitae38540042668675dd16c642d850115f217ea59f
treeb23a4966741c99d7840d4aaa77dc903baf07f0a8
parent61e59ebfa645caa3b89baaf51dd26a56625bc39f
[NewPM] Provide method to run all pipeline callbacks, used for -O0

    Some targets may add required passes via
    TargetMachine::registerPassBuilderCallbacks(). We need to run those even
    under -O0. As an example, BPFTargetMachine adds
    BPFAbstractMemberAccessPass, a required pass.

    This also allows us to clean up BackendUtil.cpp (and out-of-tree Rust
    usage of the NPM) by allowing us to share added passes like coroutines
    and sanitizers between -O0 and other optimization levels.

    Tests are a continuation of those added in
    https://reviews.llvm.org/D89083.

    In order to prevent TargetMachines from adding unnecessary optimization
    passes at -O0, TargetMachine::registerPassBuilderCallbacks() will be
    changed to take an OptimizationLevel, but that will be done separately.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D89158
clang/lib/CodeGen/BackendUtil.cpp
clang/test/CodeGen/bpf-O0.c [new file with mode: 0644]
llvm/include/llvm/Passes/PassBuilder.h
llvm/lib/Passes/PassBuilder.cpp
llvm/test/CodeGen/BPF/optnone-2.ll
llvm/test/Other/new-pm-O0-ep-callbacks.ll [new file with mode: 0644]