[PATCH] Fix failure to invoke exception handler on Win64.

Reid Kleckner rnk at google.com
Fri Aug 1 11:54:24 PDT 2014


================
Comment at: lib/Target/X86/X86FrameLowering.cpp:844
@@ +843,3 @@
+      --MFI;
+      MBBI = MFI->end();
+    }
----------------
Vadim Chugunov wrote:
> Reid Kleckner wrote:
> > Does this not return one-past-the-end?
> > 
> > That aside, I don't think this will work in general, because basic block placement runs *after* prologue-epilogue insertion.
> > 
> > For now I think we should always insert a nop if the epilogue is at the beginning of a basic block, just to be safe. The actual solution is probably to insert some kind of target-specific pseudo that we lower out after block placement to either a nop or nothing.
> > Does this not return one-past-the-end?
> Hmm, yes it probably does.
> 
> > That aside, I don't think this will work in general, because basic block placement runs *after* prologue-epilogue insertion.
> 
> I can make it do what you suggest, though I think that 'ret' starts out in a MBB of its' own quite often.
> 
> > The actual solution is probably to insert some kind of target-specific pseudo that we lower out after block placement to either a nop or nothing.
> I was considering creating 'SEH_Epilogue' pseudo, then checking for preceding CALLs when lowering it in X86AsmPrinter.   Unfortunately, some pseudos, like EH_LABEL, are not lowered till the last moment, so it'd still have to have logic to skip those.
> How does that sound?
The SEH_Epilogue pseudo sounds good, even with exciting logic to skip non-instruction pseudos.

http://reviews.llvm.org/D4751






More information about the llvm-commits mailing list