Skip to content

Commit db0471a

Browse files
admitricigcbot
authored andcommitted
[Autobackout][FuncReg]Revert of change: 93b1468
Do ProgramScopeConstantResolution later in cogeden and add SROA+Instcombine to promote constants If we still have any unresolved constants in the beginning of the codegen, we have no change to promote them to immediates after they are lowered to load/stores from constantBase. So this change moves ProgramScopeConstantResolution after MemCpy lowering and adds SROA+InstCombine to promote the constants if it becomes possible after it.
1 parent 65ed42a commit db0471a

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,15 @@ void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSignature
453453
mpm.add(llvm::createLoopSimplifyPass());
454454
}
455455

456+
457+
// Lower/Resolve OCL inlined constants.
458+
if (ctx.m_DriverInfo.NeedLoweringInlinedConstants()) {
459+
// Run additional constant breaking which is assumed by the constant
460+
// resolver.
461+
mpm.add(new BreakConstantExpr());
462+
mpm.add(new ProgramScopeConstantResolution());
463+
}
464+
456465
// This is the condition that double emulation is used.
457466
ctx.checkDPEmulationEnabled();
458467

@@ -523,19 +532,6 @@ void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSignature
523532
}
524533

525534
mpm.add(createReplaceUnsupportedIntrinsicsPass());
526-
// Lowering MemCpy may allow us to promote some program scope constants to immediates.
527-
// So adding SROA + InstCombine to eliminate alloca + propagate constants.
528-
mpm.add(createSROAPass());
529-
mpm.add(createIGCInstructionCombiningPass());
530-
531-
// Lower/Resolve OCL inlined constants.
532-
// Doing it after MemCpy lowering to have the last change to promote them to immediates.
533-
if (ctx.m_DriverInfo.NeedLoweringInlinedConstants()) {
534-
// Run additional constant breaking which is assumed by the constant
535-
// resolver.
536-
mpm.add(new BreakConstantExpr());
537-
mpm.add(new ProgramScopeConstantResolution());
538-
}
539535

540536
if (IGC_IS_FLAG_DISABLED(DisablePromoteToDirectAS) &&
541537
!ctx.getModuleMetaData()->compOpt.IsLibraryCompilation)

0 commit comments

Comments
 (0)