[llvm] [X86] Don't save/restore fp around longjmp instructions (PR #102556)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 14:17:34 PDT 2024


================
@@ -174,6 +175,9 @@ class X86MachineFunctionInfo : public MachineFunctionInfo {
   bool FPClobberedByCall = false;
   bool BPClobberedByCall = false;
 
+  // A set of instructions clobber FP generated from longjmp.
+  SmallSet<MachineInstr *, 2> LongJmpMIClobberFP;
----------------
rnk wrote:

I don't think it is safe to store MIR pointers in side tables from pass-to-pass. It is too likely that a MachineInstr will be cloned and replaced, invalidating these pointers, leading to an ABA-style use-after-free.

It also occurs to me that we may need to make sure that X86MachineFunctionInfo is fully serialized through MIR tests. I would have to look further into that.

https://github.com/llvm/llvm-project/pull/102556


More information about the llvm-commits mailing list