[llvm] r176154 - SelectionDAG: If llvm.donothing has a landingpad, we should clear
Manman Ren
mren at apple.com
Tue Feb 26 18:11:57 PST 2013
Author: mren
Date: Tue Feb 26 20:11:57 2013
New Revision: 176154
URL: http://llvm.org/viewvc/llvm-project?rev=176154&view=rev
Log:
SelectionDAG: If llvm.donothing has a landingpad, we should clear
CurrentCallSite to avoid an assertion failure:
assert(MMI.getCurrentCallSite() == 0 && "Overlapping call sites!");
rdar://problem/13228754
Added:
llvm/trunk/test/CodeGen/ARM/invoke-donothing-assert.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=176154&r1=176153&r2=176154&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Feb 26 20:11:57 2013
@@ -1872,6 +1872,13 @@ void SelectionDAGBuilder::visitInvoke(co
visitInlineAsm(&I);
else if (Fn && Fn->isIntrinsic()) {
assert(Fn->getIntrinsicID() == Intrinsic::donothing);
+ // If donothing has a landingpad, we should clear CurrentCallSite.
+ if (LandingPad) {
+ MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
+ unsigned CallSiteIndex = MMI.getCurrentCallSite();
+ if (CallSiteIndex)
+ MMI.setCurrentCallSite(0);
+ }
// Ignore invokes to @llvm.donothing: jump directly to the next BB.
} else
LowerCallTo(&I, getValue(Callee), false, LandingPad);
Added: llvm/trunk/test/CodeGen/ARM/invoke-donothing-assert.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/invoke-donothing-assert.ll?rev=176154&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/invoke-donothing-assert.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/invoke-donothing-assert.ll Tue Feb 26 20:11:57 2013
@@ -0,0 +1,40 @@
+; RUN: llc < %s -mtriple=armv7-apple-ios | FileCheck %s
+; This testcase makes sure we can handle invoke @llvm.donothing without
+; assertion failure.
+; rdar://problem/13228754
+; CHECK: .globl _main
+
+declare void @callA()
+declare i32 @__gxx_personality_sj0(...)
+
+define void @main() {
+invoke.cont:
+ invoke void @callA()
+ to label %invoke.cont25 unwind label %lpad2
+invoke.cont25:
+ invoke void @llvm.donothing()
+ to label %invoke.cont27 unwind label %lpad15
+
+invoke.cont27:
+ invoke void @callB()
+ to label %invoke.cont75 unwind label %lpad15
+
+invoke.cont75:
+ ret void
+
+lpad2:
+ %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %eh.resume
+
+lpad15:
+ %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*)
+ cleanup
+ br label %eh.resume
+
+eh.resume:
+ resume { i8*, i32 } zeroinitializer
+}
+
+declare void @callB()
+declare void @llvm.donothing() nounwind readnone
More information about the llvm-commits
mailing list