-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[MachineBasicBlock] Fix use after free in SplitCriticalEdge #68786
Conversation
Remove use after free when attempting to update SlotIndexes in MachineBasicBlock::SplitCriticalEdge. Add delegate mechanism for MachineBasicBlock to observe instructions added or removed when calling target specific functions for updating branches and update SlotIndexes appropriately.
- Use MachineFunction delegate instead
@@ -14,6 +14,7 @@ | |||
#define LLVM_CODEGEN_MACHINEBASICBLOCK_H | |||
|
|||
#include "llvm/ADT/GraphTraits.h" | |||
#include "llvm/ADT/SmallPtrSet.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I like how simple this is. Just some minor nits inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- Remove unnecessary include - Change MBB pointer to MF reference - Rename Delegate - Tidy constructor parameter names
Exactly! Thanks for the fix! |
Follow up fix for llvm#68786 to address that MachineFunction handleInsertion is actually called before a new instruction has been inserted into the block. Hence new instructions must be recorded and SlotIndex updates performed after the delegate call.
Follow up fix for #68786 to address that MachineFunction handleInsertion is actually called before a new instruction has been inserted into the block. Hence new instructions must be recorded and SlotIndex updates performed after the delegate call.
Remove use after free when attempting to update SlotIndexes in MachineBasicBlock::SplitCriticalEdge.
Add delegate mechanism for MachineBasicBlock to observe instructions added or removed when calling target specific functions for updating branches and update SlotIndexes appropriately.