Skip to content

Commit

Permalink
[CodeGen] Avoid access after runtime
Browse files Browse the repository at this point in the history
Insts must be destroyd before xParent
or it can read it with stack like this:
   0 in llvm::MachineInstr::getMF() const MachineInstr.cpp:637:3
   1 in getMF MachineInstr.h:302:50
   2 in removeNodeFromList MachineBasicBlock.cpp:163:32
  • Loading branch information
vitalybuka committed Mar 30, 2022
1 parent 6ae13b7 commit 15972e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/MachineBasicBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ class MachineBasicBlock
private:
using Instructions = ilist<MachineInstr, ilist_sentinel_tracking<true>>;

Instructions Insts;
const BasicBlock *BB;
int Number;
MachineFunction *xParent;
Instructions Insts;

/// Keep track of the predecessor / successor basic blocks.
std::vector<MachineBasicBlock *> Predecessors;
Expand Down

0 comments on commit 15972e3

Please sign in to comment.