Skip to content

Commit 9f944a7

Browse files
sys-igcigcbot
authored andcommitted
[Autobackout][FunctionalRegression]Revert of change: da392f1: Legacy Pass Manager wrapper passes
This change introduces an initial wrapper for the multiple removed LLVM passes. The wrapper allows the New Pass Manager's implementation of the pass to be executed using the Legacy Pass Manager infrastructure.
1 parent 89e7fe7 commit 9f944a7

File tree

24 files changed

+14
-837
lines changed

24 files changed

+14
-837
lines changed

IGC/AdaptorCommon/RayTracing/RayTracingInterface.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ SPDX-License-Identifier: MIT
3939
#include <llvm/Transforms/Scalar.h>
4040
#include <llvm/Transforms/Utils.h>
4141
#include <llvm/Analysis/AliasAnalysis.h>
42-
#include "llvmWrapper/Transforms/Scalar/DeadStoreElimination.h"
43-
#include "llvmWrapper/Transforms/IPO/GlobalDCE.h"
44-
4542
#include "common/LLVMWarningsPop.hpp"
4643

4744
using namespace llvm;

IGC/AdaptorOCL/UnifyIROCL.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ SPDX-License-Identifier: MIT
2323
#include <llvm/Analysis/TargetLibraryInfo.h>
2424

2525
#include <llvmWrapper/Transforms/InstCombine/InstCombineWorklist.h>
26-
#include "llvmWrapper/Transforms/IPO/GlobalDCE.h"
2726
#include <llvm/Transforms/Utils.h>
2827

2928
#include "common/LLVMWarningsPop.hpp"
@@ -406,7 +405,7 @@ static void CommonOCLBasedPasses(OpenCLProgramContext *pContext) {
406405
mpm.add(createAlwaysInlinerLegacyPass());
407406
}
408407
// The inliner sometimes fails to delete unused functions, this cleans up the remaining mess.
409-
mpm.add(IGCLLVM::createLegacyWrappedGlobalDCEPass());
408+
mpm.add(createGlobalDCEPass());
410409

411410
// Check after GlobalDCE in case of doubles in dead functions
412411
mpm.add(new ErrorCheck());

IGC/BiFManager/BiFManagerTool.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ SPDX-License-Identifier: MIT
2424
#include <llvm/IR/LegacyPassManager.h>
2525
#include <llvm/Support/FileSystem.h>
2626
#include <llvm/ADT/Triple.h>
27-
#include "llvmWrapper/Transforms/IPO/GlobalDCE.h"
28-
2927
#include "common/LLVMWarningsPop.hpp"
3028
#include "BiFManagerTool.hpp"
3129

@@ -393,7 +391,7 @@ void BiFManagerTool::generateSplitedBiFModules(llvm::Module *pMainModule) {
393391

394392
// Do cleanup.
395393
llvm::legacy::PassManager mpm;
396-
mpm.add(IGCLLVM::createLegacyWrappedGlobalDCEPass()); // Delete unreachable globals.
394+
mpm.add(createGlobalDCEPass()); // Delete unreachable globals.
397395
mpm.add(createStripDeadDebugInfoPass()); // Remove dead debug info.
398396
mpm.add(createStripDeadPrototypesPass()); // Remove dead func decls.
399397

IGC/BiFManager/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ target_include_directories("${IGC_BUILD__PROJ__BiFManager}" PRIVATE ${IGC_BUILD_
3737

3838

3939
add_executable("${IGC_BUILD__PROJ__BiFManager_EXE}"
40-
${IGC_WrapperLLVM_HDR}
41-
${IGC_WrapperLLVM_SRC}
4240
"${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
4341
"${CMAKE_CURRENT_SOURCE_DIR}/BiFManagerTool.cpp"
4442
"${CMAKE_CURRENT_SOURCE_DIR}/BiFManagerCommon.cpp"

IGC/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,6 @@ set(IGC_BUILD__HDR__IGC__igc_dll
16771677
${IGC_BUILD__HDR__IGC__igc_common}
16781678
${IGC_BUILD__HDR__IGC_DriverInterface__igc_dll}
16791679
${IGC_WrapperLLVM_HDR}
1680-
${IGC_WrapperLLVM_SRC}
16811680
)
16821681

16831682

IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,6 @@ SPDX-License-Identifier: MIT
157157
#include <llvm/Transforms/Scalar.h>
158158
#include <llvm/Bitcode/BitcodeWriter.h>
159159
#include "llvmWrapper/Transforms/Scalar/ADCE.h"
160-
#include "llvmWrapper/Transforms/Scalar/CorrelatedValuePropagation.h"
161-
#include "llvmWrapper/Transforms/Scalar/DeadStoreElimination.h"
162-
#include "llvmWrapper/Transforms/Scalar/JumpThreading.h"
163-
#include "llvmWrapper/Transforms/IPO/SCCP.h"
164-
#include "llvmWrapper/Transforms/IPO/GlobalDCE.h"
165-
#include "llvmWrapper/Transforms/Scalar/MemCpyOptimizer.h"
166-
167160
#include "common/LLVMWarningsPop.hpp"
168161
#include "Compiler/CISACodeGen/PatternMatchPass.hpp"
169162
#include "Compiler/CISACodeGen/EmitVISAPass.hpp"
@@ -658,7 +651,7 @@ void AddLegalizationPasses(CodeGenContext &ctx, IGCPassManager &mpm, PSSignature
658651

659652
if (ctx.enableFunctionCall() || ctx.type == ShaderType::RAYTRACING_SHADER) {
660653
// Sort functions if subroutine/indirect fcall is enabled.
661-
mpm.add(IGCLLVM::createLegacyWrappedGlobalDCEPass());
654+
mpm.add(llvm::createGlobalDCEPass());
662655
mpm.add(new PurgeMetaDataUtils());
663656
mpm.add(createGenXCodeGenModulePass());
664657
}
@@ -753,7 +746,7 @@ void AddLegalizationPasses(CodeGenContext &ctx, IGCPassManager &mpm, PSSignature
753746
const bool allowIPConstProp = !ctx.m_hasStackCalls && IGC_IS_FLAG_DISABLED(DisableIPConstantPropagation);
754747

755748
if (allowIPConstProp) {
756-
mpm.add(IGCLLVM::createLegacyWrappedIPSCCPPass());
749+
mpm.add(createIPSCCPPass());
757750
}
758751
mpm.add(createDeadCodeEliminationPass());
759752
mpm.add(createCFGSimplificationPass());
@@ -1229,7 +1222,7 @@ void OptimizeIR(CodeGenContext *const pContext) {
12291222
const bool allowIPConstProp = !pContext->m_hasStackCalls && IGC_IS_FLAG_DISABLED(DisableIPConstantPropagation);
12301223

12311224
if (allowIPConstProp) {
1232-
mpm.add(IGCLLVM::createLegacyWrappedIPSCCPPass());
1225+
mpm.add(createIPSCCPPass());
12331226
}
12341227
// Note / todo: LLVM < 12 also runs simple constant propagation pass
12351228
// regardless of IPSCCP in this case. This pass is not available on
@@ -1270,7 +1263,7 @@ void OptimizeIR(CodeGenContext *const pContext) {
12701263
mpm.add(createScopedNoAliasAAWrapperPass());
12711264

12721265
if (pContext->m_instrTypes.hasLoadStore) {
1273-
mpm.add(IGCLLVM::createLegacyWrappedDeadStoreEliminationPass());
1266+
mpm.add(llvm::createDeadStoreEliminationPass());
12741267
mpm.add(createMarkReadOnlyLoadPass());
12751268
}
12761269

@@ -1281,7 +1274,7 @@ void OptimizeIR(CodeGenContext *const pContext) {
12811274

12821275

12831276
if (pContext->m_instrTypes.CorrelatedValuePropagationEnable) {
1284-
mpm.add(IGCLLVM::createLegacyWrappedCorrelatedValuePropagationPass());
1277+
mpm.add(llvm::createCorrelatedValuePropagationPass());
12851278
}
12861279

12871280
mpm.add(new BreakConstantExpr());
@@ -1535,7 +1528,7 @@ void OptimizeIR(CodeGenContext *const pContext) {
15351528
#if LLVM_VERSION_MAJOR >= 15
15361529
// In LLVM-12.x an extra parameter InsertFreezeWhenUnfoldingSelect = false was added
15371530
// to JumpThreading pass, but since LLVM-15.x it was removed again.
1538-
mpm.add(IGCLLVM::createLegacyWrappedJumpThreadingPass(BBDuplicateThreshold));
1531+
mpm.add(llvm::createJumpThreadingPass(BBDuplicateThreshold));
15391532
#else // LLVM_VERSION_MAJOR
15401533
mpm.add(llvm::createJumpThreadingPass(false, BBDuplicateThreshold));
15411534
#endif // LLVM_VERSION_MAJOR
@@ -1670,8 +1663,8 @@ void OptimizeIR(CodeGenContext *const pContext) {
16701663
mpm.add(createGenSimplificationPass());
16711664

16721665
if (pContext->m_instrTypes.hasLoadStore) {
1673-
mpm.add(IGCLLVM::createLegacyWrappedDeadStoreEliminationPass());
1674-
mpm.add(IGCLLVM::createLegacyWrappedMemCpyOptPass());
1666+
mpm.add(llvm::createDeadStoreEliminationPass());
1667+
mpm.add(llvm::createMemCpyOptPass());
16751668
mpm.add(createLdShrinkPass());
16761669
}
16771670

IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ SPDX-License-Identifier: MIT
9393
#include "llvm/Transforms/Utils.h"
9494
#include "llvm/Transforms/Utils/Mem2Reg.h"
9595

96-
#include "llvmWrapper/Transforms/Scalar/CorrelatedValuePropagation.h"
97-
#include "llvmWrapper/Transforms/Scalar/JumpThreading.h"
98-
9996
using namespace llvm;
10097

10198
static cl::opt<std::string>

IGC/WrapperLLVM/CMakeLists.txt

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,27 +70,13 @@ set(IGC_WrapperLLVM_HDR
7070
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Transforms/Utils/BasicBlockUtils.h"
7171
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Transforms/InitializePasses.h"
7272
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Transforms/Scalar/ADCE.h"
73-
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Transforms/Scalar/CorrelatedValuePropagation.h"
74-
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Transforms/Scalar/DeadStoreElimination.h"
75-
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Transforms/Scalar/JumpThreading.h"
76-
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Transforms/Scalar/MemCpyOptimizer.h"
77-
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Transforms/IPO/GlobalDCE.h"
78-
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Transforms/IPO/SCCP.h"
79-
"${CMAKE_CURRENT_SOURCE_DIR}/include/llvmWrapper/Transforms/InstCombine/InstructionCombining.h"
80-
8173
"${CMAKE_CURRENT_SOURCE_DIR}/include/lldWrapper/Common/Driver.h"
8274
)
8375

8476
set(IGC_WrapperLLVM_SRC
8577
"${CMAKE_CURRENT_SOURCE_DIR}/lib/llvmWrapper/Transforms/Scalar/ADCE.cpp"
86-
"${CMAKE_CURRENT_SOURCE_DIR}/lib/llvmWrapper/Transforms/Scalar/CorrelatedValuePropagation.cpp"
87-
"${CMAKE_CURRENT_SOURCE_DIR}/lib/llvmWrapper/Transforms/Scalar/DeadStoreElimination.cpp"
88-
"${CMAKE_CURRENT_SOURCE_DIR}/lib/llvmWrapper/Transforms/Scalar/JumpThreading.cpp"
89-
"${CMAKE_CURRENT_SOURCE_DIR}/lib/llvmWrapper/Transforms/Scalar/MemCpyOptimizer.cpp"
90-
"${CMAKE_CURRENT_SOURCE_DIR}/lib/llvmWrapper/Transforms/IPO/GlobalDCE.cpp"
91-
"${CMAKE_CURRENT_SOURCE_DIR}/lib/llvmWrapper/Transforms/IPO/SCCP.cpp"
92-
"${CMAKE_CURRENT_SOURCE_DIR}/lib/llvmWrapper/Transforms/InstCombine/InstructionCombining.cpp"
93-
)
78+
)
79+
9480
include_directories(
9581
"${CMAKE_CURRENT_SOURCE_DIR}/include"
9682
"${CMAKE_CURRENT_SOURCE_DIR}"

IGC/WrapperLLVM/include/llvmWrapper/Transforms/IPO/GlobalDCE.h

Lines changed: 0 additions & 35 deletions
This file was deleted.

IGC/WrapperLLVM/include/llvmWrapper/Transforms/IPO/SCCP.h

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)