[PATCH] D14407: [WinEH] Mark funclet entries and exits as clobbering all registers

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 18:23:30 PST 2015


rnk added inline comments.

================
Comment at: lib/CodeGen/LiveIntervalAnalysis.cpp:225
@@ -224,5 +224,3 @@
   // Find all instructions with regmask operands.
-  for (MachineFunction::iterator MBBI = MF->begin(), E = MF->end();
-       MBBI != E; ++MBBI) {
-    MachineBasicBlock *MBB = &*MBBI;
-    std::pair<unsigned, unsigned> &RMB = RegMaskBlocks[MBB->getNumber()];
+  for (MachineBasicBlock &MBB : *MF) {
+    std::pair<unsigned, unsigned> &RMB = RegMaskBlocks[MBB.getNumber()];
----------------
MatzeB wrote:
> This is fine but I should go into a separate commit (which you can just commit without review).
OK

================
Comment at: lib/CodeGen/LiveIntervalAnalysis.cpp:244-249
@@ +243,8 @@
+
+    // If we see a return block with successors, this must be a funclet return.
+    // Add an extra preserves-nothing constraint to the end of the block.
+    if (MBB.isReturnBlock() && !MBB.succ_empty()) {
+      RegMaskSlots.push_back(Indexes->getMBBEndIdx(&MBB));
+      RegMaskBits.push_back(TRI->getNoPreservedMask());
+    }
+
----------------
MatzeB wrote:
> I'm confused by this part. Shouldn't the ReturnBlock end in a return instruction? How can there be successor blocks how can there be anything live across the return instruction that would require this clobbering?
Funclet returns will have successor blocks. There are two cases: the funclet returns the address of the next block that the runtime should resume execution at, or the funclet is a cleanup that returns void and the runtime will run the next cleanup or keep unwinding.

It is possible for the outermost cleanup funclet to have no successors, but it's also not interesting to put a clobber mask there, because the function will be over.


http://reviews.llvm.org/D14407





More information about the llvm-commits mailing list