
Fixes #139023. This PR essentially removes unused global variables: - Restores the `GlobalDCE` Legacy pass and adds it to the DirectX backend after the finalize linkage pass - Converts external global variables with no usage to internal linkage in the finalize linkage pass - (so they can be removed by `GlobalDCE`) - Makes the `dxil-finalize-linkage` pass usable using the new pass manager flag syntax - Adds tests to `finalize_linkage.ll` that make sure unused global variables are removed - Adds a use for variable `@CBV` in `opaque-value_as_metadata.ll` so it isn't removed - Changes the `scalar-data.ll` run command to avoid removing its global variables --------- Co-authored-by: Farzon Lotfi <farzonlotfi@microsoft.com>
48 lines
2.0 KiB
Modula-2
48 lines
2.0 KiB
Modula-2
//===- DirectXPassRegistry.def - Registry of DirectX passes -----*- C++--*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file is used as the registry of passes that are part of the
|
|
// DirectX backend.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// NOTE: NO INCLUDE GUARD DESIRED!
|
|
|
|
#ifndef MODULE_ANALYSIS
|
|
#define MODULE_ANALYSIS(NAME, CREATE_PASS)
|
|
#endif
|
|
MODULE_ANALYSIS("dx-shader-flags", dxil::ShaderFlagsAnalysis())
|
|
MODULE_ANALYSIS("dxil-root-signature-analysis", dxil::RootSignatureAnalysis())
|
|
#undef MODULE_ANALYSIS
|
|
|
|
#ifndef MODULE_PASS
|
|
#define MODULE_PASS(NAME, CREATE_PASS)
|
|
#endif
|
|
MODULE_PASS("dxil-cbuffer-access", DXILCBufferAccess())
|
|
MODULE_PASS("dxil-finalize-linkage", DXILFinalizeLinkage())
|
|
MODULE_PASS("dxil-data-scalarization", DXILDataScalarization())
|
|
MODULE_PASS("dxil-flatten-arrays", DXILFlattenArrays())
|
|
MODULE_PASS("dxil-intrinsic-expansion", DXILIntrinsicExpansion())
|
|
MODULE_PASS("dxil-op-lower", DXILOpLowering())
|
|
MODULE_PASS("dxil-pretty-printer", DXILPrettyPrinterPass(dbgs()))
|
|
MODULE_PASS("dxil-translate-metadata", DXILTranslateMetadata())
|
|
MODULE_PASS("dxil-resource-implicit-binding", DXILResourceImplicitBinding())
|
|
MODULE_PASS("dxil-post-optimization-validation", DXILPostOptimizationValidation())
|
|
// TODO: rename to print<foo> after NPM switch
|
|
MODULE_PASS("print-dx-shader-flags", dxil::ShaderFlagsAnalysisPrinter(dbgs()))
|
|
MODULE_PASS("print<dxil-root-signature>", dxil::RootSignatureAnalysisPrinter(dbgs()))
|
|
#undef MODULE_PASS
|
|
|
|
#ifndef FUNCTION_PASS
|
|
#define FUNCTION_PASS(NAME, CREATE_PASS)
|
|
#endif
|
|
FUNCTION_PASS("dxil-forward-handle-accesses", DXILForwardHandleAccesses())
|
|
FUNCTION_PASS("dxil-resource-access", DXILResourceAccess())
|
|
FUNCTION_PASS("dxil-legalize", DXILLegalizePass())
|
|
#undef FUNCTION_PASS
|