[llvm] 15972e3 - [CodeGen] Avoid access after runtime
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 30 02:08:19 PDT 2022
Author: Vitaly Buka
Date: 2022-03-30T02:08:13-07:00
New Revision: 15972e37bad05b516f78f7879efb85521e4501b3
URL: https://github.com/llvm/llvm-project/commit/15972e37bad05b516f78f7879efb85521e4501b3
DIFF: https://github.com/llvm/llvm-project/commit/15972e37bad05b516f78f7879efb85521e4501b3.diff
LOG: [CodeGen] Avoid access after runtime
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
Added:
Modified:
llvm/include/llvm/CodeGen/MachineBasicBlock.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
index b730e6308c91c..7d9a9ac505fa3 100644
--- a/llvm/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
@@ -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;
More information about the llvm-commits
mailing list