Skip to content

Commit 2a551e0

Browse files
MaciejKalinskisys_zuul
authored andcommitted
Add Induction Variable Elimination pass.
This pass, also referred as IndVarSimplify pass, is generic LLVM pass. When added to OptimizeIR() function, it improves performance for cases like in this pseudo code: uint max = data[thread_invocation_id]; for(uint i = 0; i < max; ++i) { n += 321; } With this pass the code can be transformed to just: n += 321 * data[thread_invocation_id]; Change-Id: Ie536a5d487bdc4b15f648454a653dfe030eb7764
1 parent c0a1b28 commit 2a551e0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,7 @@ namespace IGC
14391439
// disable loop unroll for excessive large shaders
14401440
if (pContext->m_instrTypes.hasLoop)
14411441
{
1442+
mpm.add(createIndVarSimplifyPass());
14421443
mpm.add(createLoopDeadCodeEliminationPass());
14431444
mpm.add(createLoopCanonicalization());
14441445
mpm.add(llvm::createLoopDeletionPass());

0 commit comments

Comments
 (0)