[llvm] r234948 - [WinEH] Avoid emitting xdata tables twice for cleanups
Reid Kleckner
reid at kleckner.net
Tue Apr 14 14:42:37 PDT 2015
Author: rnk
Date: Tue Apr 14 16:42:36 2015
New Revision: 234948
URL: http://llvm.org/viewvc/llvm-project?rev=234948&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp
llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-cleanups.ll
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp?rev=234948&r1=234947&r2=234948&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp Tue Apr 14 16:42:36 2015
@@ -344,9 +344,11 @@ void Win64Exception::emitCXXFrameHandler
}
// 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;
Modified: llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-cleanups.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-cleanups.ll?rev=234948&r1=234947&r2=234948&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-cleanups.ll (original)
+++ llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-cleanups.ll Tue Apr 14 16:42:36 2015
@@ -199,7 +199,16 @@ entry:
%s.i8 = call i8* @llvm.framerecover(i8* bitcast (void (i1)* @"\01?test2@@YAX_N at Z" to i8*), i8* %1, i32 0)
%s = bitcast i8* %s.i8 to %struct.S*
call void @"\01??_DS@@QEAA at 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 at Z.cleanup1"(i8*, i8*) #7 {
@@ -207,9 +216,20 @@ entry:
%s1.i8 = call i8* @llvm.framerecover(i8* bitcast (void (i1)* @"\01?test2@@YAX_N at Z" to i8*), i8* %1, i32 1)
%s1 = bitcast i8* %s1.i8 to %struct.S*
call void @"\01??_DS@@QEAA at 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 at Z" }
More information about the llvm-commits
mailing list