[llvm] [StackColoring] Handle SEH catch object stack slots conservatively (PR #66988)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 13:19:24 PDT 2023


================
@@ -739,14 +695,23 @@ unsigned StackColoring::collectMarkers(unsigned NumSlot) {
     return 0;
   }
 
-  // 1) PR27903: slots with multiple start or end lifetime ops are not
+  // PR27903: slots with multiple start or end lifetime ops are not
   // safe to enable for "lifetime-start-on-first-use".
-  // 2) And also not safe for variable X in catch(X) in windows.
   for (unsigned slot = 0; slot < NumSlot; ++slot) {
-    if (NumStartLifetimes[slot] > 1 || NumEndLifetimes[slot] > 1 ||
-        (NumLoadInCatchPad[slot] > 1 && !StoreSlots.test(slot)))
+    if (NumStartLifetimes[slot] > 1 || NumEndLifetimes[slot] > 1)
       ConservativeSlots.set(slot);
   }
+
+  // The write to the catch object by the personality function is not propely
+  // modeled in IR: It happens before any cleanuppads are executed, even if the
----------------
efriedma-quic wrote:

We could also do some sort of fixup during ISel, I think?  The analysis here is looking at MachineInstrs, so we could add frameindex references to the call instructions.

(I think it's generally a good idea to try to get the MachineIR into the form we want, then consider if we want to make corresponding IR changes.)

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


More information about the llvm-commits mailing list