Skip to content

Conversation

@tkf
Copy link
Member

@tkf tkf commented Jul 7, 2021

I just noticed this by reading #41115 and I don't know if there are any problems with this. But it seems to be more appropriate to use labelchangemap for renaming PhiNode edges, considering how other goto labels are renamed? Although I guess we normally have ssachangemap === labelchangemap.

Also, since #41115 is backported, this needs to be backported if merged?

@tkf tkf requested a review from Keno July 7, 2021 20:49
@Keno
Copy link
Member

Keno commented Jul 7, 2021

I considered this, but the phi node edges are not "goto" labels, they are "comefrom" labels, so I think the SSA change map for the SSA of the branch node would be the correct map.

@tkf
Copy link
Member Author

tkf commented Jul 7, 2021

Hmm... I thought a change like this would be required if we want to use renumber_ir_elements!((ir::IRCode).stmts.inst, ssachangemap, labelchangemap) where the labels are actually BB indices? But I don't know if there is a use case like this. So, please feel free to close this if you think the code as-is works fine. I just thought it could be a typo or something.

@tkf
Copy link
Member Author

tkf commented Jul 7, 2021

Actually, I just realized that I might have misunderstood the purpose of labelchangemap. I thought it was there for making this generic over the IR formats IRCode/CodeInfo. But it's useful even within CodeInfo where you want to rename SSA uses and labels differently.

@tkf tkf closed this Jul 7, 2021
@Keno
Copy link
Member

Keno commented Jul 7, 2021

renumber_ir_elements!((ir::IRCode).stmts.inst, ssachangemap, labelchangemap)

Consider that GotoNodes need to be changed to the first statements in a BB, while PhiNodes need the last statement in a BB.

@tkf
Copy link
Member Author

tkf commented Jul 7, 2021

Yeah, that's a part of my reasoning just before closing it. For full generality for IRCode, we need three maps ssachangemap, gotolabelchangemap, and philabelchangemap (which I actually needed to implement). "Combining" philabelchangemap into ssachangemap is more useful when the main use is with CodeInfo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants