@@ -288,18 +288,6 @@ void replaceBranchTargets(BasicBlock *BB, BasicBlock *OldTarget,
288
288
assert (false && " Unhandled terminator type." );
289
289
}
290
290
291
- // Replaces basic bloc operands |OldSrc| or OpPhi instructions in |BB| by
292
- // |NewSrc|. This function does not simplify the OpPhi instruction once
293
- // transformed.
294
- void replacePhiTargets (BasicBlock *BB, BasicBlock *OldSrc, BasicBlock *NewSrc) {
295
- for (PHINode &Phi : BB->phis ()) {
296
- int index = Phi.getBasicBlockIndex (OldSrc);
297
- if (index == -1 )
298
- continue ;
299
- Phi.setIncomingBlock (index, NewSrc);
300
- }
301
- }
302
-
303
291
} // anonymous namespace
304
292
305
293
// Given a reducible CFG, produces a structurized CFG in the SPIR-V sense,
@@ -463,7 +451,6 @@ class SPIRVStructurizer : public FunctionPass {
463
451
BasicBlock *NewSrc =
464
452
BasicBlock::Create (F.getContext (), " new.src" , &F);
465
453
replaceBranchTargets (Src, Dst, NewSrc);
466
- // replacePhiTargets(Dst, Src, NewSrc);
467
454
IRBuilder<> Builder (NewSrc);
468
455
Builder.CreateBr (Dst);
469
456
Src = NewSrc;
@@ -507,7 +494,6 @@ class SPIRVStructurizer : public FunctionPass {
507
494
if (Dsts.size () == 1 ) {
508
495
for (auto &[Src, Dst] : FixedEdges) {
509
496
replaceBranchTargets (Src, Dst, NewExit);
510
- // replacePhiTargets(Dst, Src, NewExit);
511
497
}
512
498
ExitBuilder.CreateBr (Dsts[0 ]);
513
499
return NewExit;
0 commit comments