[PATCH] D44640: [CodeGen] Add funclet token to ARC marker

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 19 11:57:04 PDT 2018


smeenai created this revision.
smeenai added reviewers: ahatanak, compnerd, majnemer, rjmccall, rnk.

The inline assembly generated for the ARC autorelease elision marker
must have a funclet token if it's emitted inside a funclet, otherwise
the inline assembly (and all subsequent code in the funclet) will be
marked unreachable. r324689 fixed this issue for regular inline assembly
blocks.

Note that clang only emits the marker at -O0, so this only fixes that
case. The optimizations case (where the marker is emitted by the
backend) will be fixed in a separate change.


Repository:
  rC Clang

https://reviews.llvm.org/D44640

Files:
  lib/CodeGen/CGObjC.cpp
  test/CodeGenObjCXX/arc-marker-funclet.mm


Index: test/CodeGenObjCXX/arc-marker-funclet.mm
===================================================================
--- /dev/null
+++ test/CodeGenObjCXX/arc-marker-funclet.mm
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fobjc-runtime=ios-6.0 -fobjc-arc \
+// RUN:   -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s
+
+id f();
+void g() {
+  try {
+    f();
+  } catch (...) {
+    f();
+  }
+}
+
+// CHECK: call i8* @"\01?f@@YAPAUobjc_object@@XZ"() [ "funclet"(token %1) ]
+// CHECK-NEXT: call void asm sideeffect "movl{{.*}}%ebp, %ebp{{.*}}", ""() [ "funclet"(token %1) ]
+
+// The corresponding f() call was invoked from the entry basic block.
+// CHECK: call void asm sideeffect "movl{{.*}}%ebp, %ebp{{.*}}", ""(){{$}}
Index: lib/CodeGen/CGObjC.cpp
===================================================================
--- lib/CodeGen/CGObjC.cpp
+++ lib/CodeGen/CGObjC.cpp
@@ -2034,7 +2034,7 @@
 
   // Call the marker asm if we made one, which we do only at -O0.
   if (marker)
-    CGF.Builder.CreateCall(marker);
+    CGF.Builder.CreateCall(marker, None, CGF.getBundlesForFunclet(marker));
 }
 
 /// Retain the given object which is the result of a function call.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44640.138973.patch
Type: text/x-patch
Size: 1210 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180319/fb6723c5/attachment-0001.bin>


More information about the cfe-commits mailing list