[WinEH] Avoid emitting xdata tables twice for cleanups

Since adding invokes of llvm.donothing to cleanups, we come here now,
and trivial EH cleanup usage from clang fails to compile.

llvm-svn: 234948
This commit is contained in:
Reid Kleckner 2015-04-14 21:42:36 +00:00
parent ed796d518c
commit e5f13831d0
2 changed files with 25 additions and 3 deletions

View File

@ -344,9 +344,11 @@ void Win64Exception::emitCXXFrameHandler3Table(const MachineFunction *MF) {
}
// Defer emission until we've visited the parent function and all the catch
// handlers.
if (ParentF == F || FuncInfo.CatchHandlerMaxState.count(F))
++FuncInfo.NumIPToStateFuncsVisited;
// handlers. Cleanups don't contribute to the ip2state table yet, so don't
// count them.
if (ParentF != F && !FuncInfo.CatchHandlerMaxState.count(F))
return;
++FuncInfo.NumIPToStateFuncsVisited;
if (FuncInfo.NumIPToStateFuncsVisited != FuncInfo.CatchHandlerMaxState.size())
return;

View File

@ -199,7 +199,16 @@ entry:
%s.i8 = call i8* @llvm.framerecover(i8* bitcast (void (i1)* @"\01?test2@@YAX_N@Z" to i8*), i8* %1, i32 0)
%s = bitcast i8* %s.i8 to %struct.S*
call void @"\01??_DS@@QEAA@XZ"(%struct.S* %s) #4
invoke void @llvm.donothing()
to label %entry.split unwind label %stub
entry.split: ; preds = %entry
ret void
stub: ; preds = %entry
%2 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
cleanup
unreachable
}
define internal void @"\01?test2@@YAX_N@Z.cleanup1"(i8*, i8*) #7 {
@ -207,9 +216,20 @@ entry:
%s1.i8 = call i8* @llvm.framerecover(i8* bitcast (void (i1)* @"\01?test2@@YAX_N@Z" to i8*), i8* %1, i32 1)
%s1 = bitcast i8* %s1.i8 to %struct.S*
call void @"\01??_DS@@QEAA@XZ"(%struct.S* %s1) #4
invoke void @llvm.donothing()
to label %entry.split unwind label %stub
entry.split: ; preds = %entry
ret void
stub: ; preds = %entry
%2 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
cleanup
unreachable
}
declare void @llvm.donothing()
attributes #0 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" "wineh-parent"="?test1@@YAXXZ" }
attributes #1 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" "wineh-parent"="?test2@@YAX_N@Z" }