-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[LoongArch] Add isSafeToMove hook to prevent unsafe instruction motion
#163725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1979,6 +1979,7 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) { | |
| MachineBasicBlock::iterator FIB = FBB->begin(); | ||
| MachineBasicBlock::iterator TIE = TBB->end(); | ||
| MachineBasicBlock::iterator FIE = FBB->end(); | ||
| MachineFunction &MF = *MBB->getParent(); | ||
| while (TIB != TIE && FIB != FIE) { | ||
| // Skip dbg_value instructions. These do not count. | ||
| TIB = skipDebugInstructionsForward(TIB, TIE, false); | ||
|
|
@@ -1993,6 +1994,10 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) { | |
| // Hard to reason about register liveness with predicated instruction. | ||
| break; | ||
|
|
||
| if (!TII->isSafeToMove(*TIB, MBB, MF)) | ||
| // Don't hoist the instruction if it isn't safe to move. | ||
| break; | ||
|
|
||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @OCHyams mind taking a look at the changes here when you get a chance? Thanks!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not best placed to review a target hook change - I'm not sure of best practice there. Your change here in BranchFolding.cpp STGM though. |
||
| bool IsSafe = true; | ||
| for (MachineOperand &MO : TIB->operands()) { | ||
| // Don't attempt to hoist instructions with register masks. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.