Skip to content

Commit 811891f

Browse files
committed
Instruction combining is not able to combine circular phi-select
instructions leading to the same instruction. Example: Entry: %0 = load <4 x float> While.body: %1 = phi <4 x float> [ %0, %entry ], [ %2, %while.end ] ... %2 = select i1 %switch_cond, <4 x float> %0, <4 x float> %1 Change-Id: I463d49a2dfae3a836e2c98d48b23096d3b3022c5
1 parent 9a29895 commit 811891f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,10 @@ void OptimizeIR(CodeGenContext* pContext)
13291329
// Use CFGSimplification to do clean-up. Needs to be invoked before lowerSwitch.
13301330
mpm.add(llvm::createCFGSimplificationPass());
13311331

1332-
if(IGC_IS_FLAG_DISABLED(DisableFlattenSmallSwitch))
1332+
// run instruction combining to clean up the code after CFG optimizations
1333+
mpm.add(createIGCInstructionCombiningPass());
1334+
1335+
if (IGC_IS_FLAG_DISABLED(DisableFlattenSmallSwitch))
13331336
{
13341337
mpm.add(createFlattenSmallSwitchPass());
13351338
}
@@ -1338,9 +1341,6 @@ void OptimizeIR(CodeGenContext* pContext)
13381341
// After lowering 'switch', run jump threading to remove redundant jumps.
13391342
mpm.add(llvm::createJumpThreadingPass());
13401343

1341-
// run instruction combining to clean up the code after CFG optimizations
1342-
mpm.add(createIGCInstructionCombiningPass());
1343-
13441344
mpm.add(llvm::createDeadCodeEliminationPass());
13451345
mpm.add(llvm::createEarlyCSEPass());
13461346

0 commit comments

Comments
 (0)