r327892 - [CodeGen] Add funclet token to ARC marker

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 19 12:34:39 PDT 2018


Author: smeenai
Date: Mon Mar 19 12:34:39 2018
New Revision: 327892

URL: http://llvm.org/viewvc/llvm-project?rev=327892&view=rev
Log:
[CodeGen] Add funclet token to ARC marker

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.

Differential Revision: https://reviews.llvm.org/D44640

Added:
    cfe/trunk/test/CodeGenObjCXX/arc-marker-funclet.mm
Modified:
    cfe/trunk/lib/CodeGen/CGObjC.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=327892&r1=327891&r2=327892&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Mon Mar 19 12:34:39 2018
@@ -2034,7 +2034,7 @@ static void emitAutoreleasedReturnValueM
 
   // 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.

Added: cfe/trunk/test/CodeGenObjCXX/arc-marker-funclet.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/arc-marker-funclet.mm?rev=327892&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/arc-marker-funclet.mm (added)
+++ cfe/trunk/test/CodeGenObjCXX/arc-marker-funclet.mm Mon Mar 19 12:34:39 2018
@@ -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* @"?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{{.*}}", ""(){{$}}




More information about the cfe-commits mailing list