@@ -658,18 +658,6 @@ void AddLegalizationPasses(CodeGenContext &ctx, IGCPassManager &mpm, PSSignature
658
658
if (!isOptDisabled && ctx.m_instrTypes .hasLoadStore && IGC_IS_FLAG_DISABLED (DisableMemOpt) &&
659
659
!ctx.getModuleMetaData ()->disableMemOptforNegativeOffsetLoads ) {
660
660
661
- #if LLVM_VERSION_MAJOR <= 10
662
- if (ctx.type == ShaderType::OPENCL_SHADER) {
663
- // Some LLVM passes may produce load/store instructions without alignment set,
664
- // for example SROA. LLVM API has been changed to ensure that alignment is never
665
- // missing, it has been changed in LLVM11: https://reviews.llvm.org/D77454.
666
- // Merging loads/stores without alignment set results in producing loads/stores
667
- // that operate on a bigger types, hence loosing an information about actual alignment.
668
- // AlignmentAnalysis restores alignments based on data-flow analysis, so that MemOpt
669
- // can propagate the correct alignment to the merged instructions.
670
- mpm.add (new AlignmentAnalysis ());
671
- }
672
- #endif
673
661
674
662
if ((ctx.type == ShaderType::RAYTRACING_SHADER || ctx.hasSyncRTCalls ()) &&
675
663
IGC_IS_FLAG_DISABLED (DisablePrepareLoadsStores)) {
@@ -736,20 +724,9 @@ void AddLegalizationPasses(CodeGenContext &ctx, IGCPassManager &mpm, PSSignature
736
724
737
725
const bool allowIPConstProp = !ctx.m_hasStackCalls && IGC_IS_FLAG_DISABLED (DisableIPConstantPropagation);
738
726
739
- #if LLVM_VERSION_MAJOR >= 12
740
727
if (allowIPConstProp) {
741
728
mpm.add (createIPSCCPPass ());
742
729
}
743
- // Note / todo: LLVM < 12 also runs simple constant propagation pass regardless
744
- // of IPSCCP in this case.
745
- // This pass is not available on >= 12 version, but maybe SCCP pass would
746
- // be suitable here.
747
- #else
748
- if (allowIPConstProp) {
749
- mpm.add (createIPConstantPropagationPass ());
750
- }
751
- mpm.add (createConstantPropagationPass ());
752
- #endif
753
730
754
731
mpm.add (createDeadCodeEliminationPass ());
755
732
mpm.add (createCFGSimplificationPass ());
@@ -1189,19 +1166,12 @@ void OptimizeIR(CodeGenContext *const pContext) {
1189
1166
// Don't run IPConstantProp if there are stackcalls
1190
1167
const bool allowIPConstProp = !pContext->m_hasStackCalls && IGC_IS_FLAG_DISABLED (DisableIPConstantPropagation);
1191
1168
1192
- #if LLVM_VERSION_MAJOR >= 12
1193
1169
if (allowIPConstProp) {
1194
1170
mpm.add (createIPSCCPPass ());
1195
1171
}
1196
1172
// Note / todo: LLVM < 12 also runs simple constant propagation pass
1197
1173
// regardless of IPSCCP in this case. This pass is not available on
1198
1174
// >= 12 version, but maybe SCCP pass would be suitable here.
1199
- #else
1200
- mpm.add (createConstantPropagationPass ());
1201
- if (allowIPConstProp) {
1202
- mpm.add (createIPConstantPropagationPass ());
1203
- }
1204
- #endif
1205
1175
}
1206
1176
if (IGC_IS_FLAG_ENABLED (MSAA16BitPayloadEnable) && pContext->platform .support16bitMSAAPayload ()) {
1207
1177
mpm.add (new ConvertMSAAPayloadTo16Bit ());
@@ -1224,11 +1194,7 @@ void OptimizeIR(CodeGenContext *const pContext) {
1224
1194
mpm.add (new HoistCongruentPHI ());
1225
1195
mpm.add (new CodeSinking ());
1226
1196
}
1227
- #if LLVM_VERSION_MAJOR >= 12
1228
1197
mpm.add (llvm::createCFGSimplificationPass (SimplifyCFGOptions ().hoistCommonInsts (true )));
1229
- #else
1230
- mpm.add (llvm::createCFGSimplificationPass ());
1231
- #endif
1232
1198
1233
1199
mpm.add (llvm::createBasicAAWrapperPass ());
1234
1200
mpm.add (createAddressSpaceAAWrapperPass ());
@@ -1461,7 +1427,6 @@ void OptimizeIR(CodeGenContext *const pContext) {
1461
1427
1462
1428
mpm.add (new BreakConstantExpr ());
1463
1429
mpm.add (new IGCConstProp (IGC_IS_FLAG_ENABLED (EnableSimplifyGEP)));
1464
- #if LLVM_VERSION_MAJOR >= 14
1465
1430
// Now that constant propagation is largely complete, perform
1466
1431
// initial evaluation of freeze instructions. We need this to make
1467
1432
// life easier for subsequent LLVM passes, as passes like
@@ -1471,7 +1436,6 @@ void OptimizeIR(CodeGenContext *const pContext) {
1471
1436
// TODO: Check if LLVM 15+ provides improvements in that regard,
1472
1437
// alleviating the need for early freeze evaluation.
1473
1438
mpm.add (createEvaluateFreezePass ());
1474
- #endif // LLVM_VERSION_MAJOR
1475
1439
1476
1440
if (IGC_IS_FLAG_DISABLED (DisableImmConstantOpt)) {
1477
1441
// If we have ICBs, need to emit clamp code so OOB access doesn't occur
@@ -1506,7 +1470,7 @@ void OptimizeIR(CodeGenContext *const pContext) {
1506
1470
// We need to increase default duplication threshold since JumpThreading pass cost estimation does
1507
1471
// not consider that not all instructions need to be duplicated.
1508
1472
int BBDuplicateThreshold = (pContext->type == ShaderType::OPENCL_SHADER) ? 9 : -1 ;
1509
- #if LLVM_VERSION_MAJOR >= 15 || LLVM_VERSION_MAJOR < 12
1473
+ #if LLVM_VERSION_MAJOR >= 15
1510
1474
// In LLVM-12.x an extra parameter InsertFreezeWhenUnfoldingSelect = false was added
1511
1475
// to JumpThreading pass, but since LLVM-15.x it was removed again.
1512
1476
mpm.add (llvm::createJumpThreadingPass (BBDuplicateThreshold));
0 commit comments