@@ -658,18 +658,6 @@ void AddLegalizationPasses(CodeGenContext &ctx, IGCPassManager &mpm, PSSignature
658658 if (!isOptDisabled && ctx.m_instrTypes .hasLoadStore && IGC_IS_FLAG_DISABLED (DisableMemOpt) &&
659659 !ctx.getModuleMetaData ()->disableMemOptforNegativeOffsetLoads ) {
660660
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
673661
674662 if ((ctx.type == ShaderType::RAYTRACING_SHADER || ctx.hasSyncRTCalls ()) &&
675663 IGC_IS_FLAG_DISABLED (DisablePrepareLoadsStores)) {
@@ -736,20 +724,9 @@ void AddLegalizationPasses(CodeGenContext &ctx, IGCPassManager &mpm, PSSignature
736724
737725 const bool allowIPConstProp = !ctx.m_hasStackCalls && IGC_IS_FLAG_DISABLED (DisableIPConstantPropagation);
738726
739- #if LLVM_VERSION_MAJOR >= 12
740727 if (allowIPConstProp) {
741728 mpm.add (createIPSCCPPass ());
742729 }
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
753730
754731 mpm.add (createDeadCodeEliminationPass ());
755732 mpm.add (createCFGSimplificationPass ());
@@ -1189,19 +1166,12 @@ void OptimizeIR(CodeGenContext *const pContext) {
11891166 // Don't run IPConstantProp if there are stackcalls
11901167 const bool allowIPConstProp = !pContext->m_hasStackCalls && IGC_IS_FLAG_DISABLED (DisableIPConstantPropagation);
11911168
1192- #if LLVM_VERSION_MAJOR >= 12
11931169 if (allowIPConstProp) {
11941170 mpm.add (createIPSCCPPass ());
11951171 }
11961172 // Note / todo: LLVM < 12 also runs simple constant propagation pass
11971173 // regardless of IPSCCP in this case. This pass is not available on
11981174 // >= 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
12051175 }
12061176 if (IGC_IS_FLAG_ENABLED (MSAA16BitPayloadEnable) && pContext->platform .support16bitMSAAPayload ()) {
12071177 mpm.add (new ConvertMSAAPayloadTo16Bit ());
@@ -1224,11 +1194,7 @@ void OptimizeIR(CodeGenContext *const pContext) {
12241194 mpm.add (new HoistCongruentPHI ());
12251195 mpm.add (new CodeSinking ());
12261196 }
1227- #if LLVM_VERSION_MAJOR >= 12
12281197 mpm.add (llvm::createCFGSimplificationPass (SimplifyCFGOptions ().hoistCommonInsts (true )));
1229- #else
1230- mpm.add (llvm::createCFGSimplificationPass ());
1231- #endif
12321198
12331199 mpm.add (llvm::createBasicAAWrapperPass ());
12341200 mpm.add (createAddressSpaceAAWrapperPass ());
@@ -1461,7 +1427,6 @@ void OptimizeIR(CodeGenContext *const pContext) {
14611427
14621428 mpm.add (new BreakConstantExpr ());
14631429 mpm.add (new IGCConstProp (IGC_IS_FLAG_ENABLED (EnableSimplifyGEP)));
1464- #if LLVM_VERSION_MAJOR >= 14
14651430 // Now that constant propagation is largely complete, perform
14661431 // initial evaluation of freeze instructions. We need this to make
14671432 // life easier for subsequent LLVM passes, as passes like
@@ -1471,7 +1436,6 @@ void OptimizeIR(CodeGenContext *const pContext) {
14711436 // TODO: Check if LLVM 15+ provides improvements in that regard,
14721437 // alleviating the need for early freeze evaluation.
14731438 mpm.add (createEvaluateFreezePass ());
1474- #endif // LLVM_VERSION_MAJOR
14751439
14761440 if (IGC_IS_FLAG_DISABLED (DisableImmConstantOpt)) {
14771441 // If we have ICBs, need to emit clamp code so OOB access doesn't occur
@@ -1506,7 +1470,7 @@ void OptimizeIR(CodeGenContext *const pContext) {
15061470 // We need to increase default duplication threshold since JumpThreading pass cost estimation does
15071471 // not consider that not all instructions need to be duplicated.
15081472 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
15101474 // In LLVM-12.x an extra parameter InsertFreezeWhenUnfoldingSelect = false was added
15111475 // to JumpThreading pass, but since LLVM-15.x it was removed again.
15121476 mpm.add (llvm::createJumpThreadingPass (BBDuplicateThreshold));
0 commit comments