[llvm] InstructionSelect: Use GISelChangeObserver instead of MachineFunction::Delegate (PR #105725)
Tobias Stadler via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 22 16:19:46 PDT 2024
================
@@ -75,19 +75,21 @@ InstructionSelect::InstructionSelect(CodeGenOptLevel OL, char &PassID)
/// a non-obvious limitation for selector implementers. Therefore, to allow
/// deletion of arbitrary instructions, we detect this case and continue
/// selection with the predecessor of the deleted instruction.
-class InstructionSelect::MIIteratorMaintainer
- : public MachineFunction::Delegate {
+class InstructionSelect::MIIteratorMaintainer : public GISelChangeObserver {
#ifndef NDEBUG
SmallSetVector<const MachineInstr *, 32> CreatedInstrs;
#endif
public:
MachineBasicBlock::reverse_iterator MII;
- void MF_HandleInsertion(MachineInstr &MI) override {
+ void changingInstr(MachineInstr &MI) override {}
+ void changedInstr(MachineInstr &MI) override {}
----------------
tobias-stadler wrote:
Please add `llvm_unreachable("InstructionSelect does not track changed instructions!");` or similar to changingInstr and changedInstr. We only install a Delegate instead of a full observer on purpose. We don't want this to be changed by accident and we don't want InstructionSelector implementations to start calling this thinking it does the right thing.
https://github.com/llvm/llvm-project/pull/105725
More information about the llvm-commits
mailing list