<div dir="auto">for example<div dir="auto"><br></div><div dir="auto">I want to insert a new machine bb “before” a specific machine bb.</div><div dir="auto"><br></div><div dir="auto"><span style="font-family:sans-serif">or split a mbb and keep the later one as the original one.</span><br></div><div dir="auto"><span style="font-family:sans-serif">(to keep the label/Blackadder's correct</span></div><div dir="auto"><span style="font-family:sans-serif">t)</span></div><div dir="auto"><span style="font-family:sans-serif">(or keep other property of mbb)</span></div><div dir="auto"><br></div><div dir="auto">so I need to transfer the original mbb's predecessor to the new mbb.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Nicolai Hähnle <<a href="mailto:nhaehnle@gmail.com">nhaehnle@gmail.com</a>> 於 2020年3月13日 週五 23:57 寫道:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Mar 13, 2020 at 12:22 PM PenYiWang via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" rel="noreferrer">llvm-dev@lists.llvm.org</a>> wrote:<br>
> I found that there is transferSuccessors() in MachineBasicBlcok<br>
><br>
> So that when manipulating MachineBasicBlock,<br>
> we can use transferSuccessors to update the CFG easily.<br>
><br>
> Why there is not transferPredecessors in  MachineBasicBlcok ?<br>
<br>
What would you want to use it for? If it's for splitting a block: the<br>
common pattern for splitting seems to be to create a new block that<br>
will be the successor of the old one rather than the other way around.<br>
One good reason for this is that doing it this way only requires<br>
fixing up (target-independent) phi instructions, while doing it the<br>
other way around would require fixing up the (target-specific!) branch<br>
instructions.<br>
<br>
Cheers,<br>
Nicolai<br>
<br>
<br>
-- <br>
Lerne, wie die Welt wirklich ist,<br>
aber vergiss niemals, wie sie sein sollte.<br>
</blockquote></div>