This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Introduce MachineBasicBlock::replacePhiUsesOfBlockWith helper and use it. NFC
ClosedPublic

Authored by bjope on Aug 26 2019, 9:34 AM.

Details

Summary

Found a couple of places in the code where all the PHI nodes
of a MBB is updated, replacing references to one MBB by
reference to another MBB instead.

This patch simply refactors the code to use a common helper
(MachineBasicBlock::replacePhiUsesOfBlockWith) for such PHI
node updates.

Diff Detail

Repository
rL LLVM

Event Timeline

bjope created this revision.Aug 26 2019, 9:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2019, 9:34 AM
arsenm added inline comments.Aug 26 2019, 10:25 AM
llvm/include/llvm/CodeGen/MachineBasicBlock.h
496–497 ↗(On Diff #217180)

I don't think updatePHIs is a good name for a public version of this. replacePhiPredecessorWith maybe?

bjope added inline comments.Aug 26 2019, 11:27 AM
llvm/include/llvm/CodeGen/MachineBasicBlock.h
496–497 ↗(On Diff #217180)

True that. replacePhiPredecessorWith sounds good to me.

bjope updated this revision to Diff 217316.Aug 27 2019, 1:04 AM

Update: Renamed updatePHIs as replacePhiUsesOfBlockWith. Name choosen to "match" the already existing ReplaceUsesOfBlockWith which basically does the same thing but for all instructions in the block.

bjope retitled this revision from [CodeGen] Introduce MachineBasicBlock::updatePHIs helper and use it. NFC to [CodeGen] Introduce MachineBasicBlock::replacePhiUsesOfBlockWith helper and use it. NFC.Aug 27 2019, 1:05 AM
bjope edited the summary of this revision. (Show Details)
This revision was not accepted when it landed; it landed in state Needs Review.Aug 30 2019, 4:22 AM
This revision was automatically updated to reflect the committed changes.