[PATCH] Fix failure to invoke exception handler on Win64.
Reid Kleckner
rnk at google.com
Fri Aug 1 11:16:10 PDT 2014
================
Comment at: lib/Target/X86/X86FrameLowering.cpp:838
@@ +837,3 @@
+ MachineFunction* MF = MFI->getParent();
+Skip:
+ if (MBBI == MFI->begin()) {
----------------
This seems like a do { } while (...) loop.
================
Comment at: lib/Target/X86/X86FrameLowering.cpp:844
@@ +843,3 @@
+ --MFI;
+ MBBI = MFI->end();
+ }
----------------
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.
================
Comment at: test/CodeGen/X86/win64_call_epi.ll:1
@@ +1,2 @@
+; RUN: llc < %s -O0 -mcpu=corei7 -mtriple=x86_64-pc-mingw32 | FileCheck %s -check-prefix=WIN64
+
----------------
Does this fail without -O0? Just curious.
================
Comment at: test/CodeGen/X86/win64_call_epi.ll:3
@@ +2,3 @@
+
+define void @foo() {
+
----------------
Can you come up with a test case that fails when block placement runs? Something like this maybe:
define void @bar(i1 zeroext %cond ) {
br i1 %cond, label %a, label %b ; <- Add metadata to indicate that %a is *highly* likely over %b.
a:
call void @foo()
br label %done
b:
call void @baz()
store i32 0, i32* @something
br label %done
done:
ret void
}
http://reviews.llvm.org/D4751
More information about the llvm-commits
mailing list