[cfe-commits] r169755 - in /cfe/trunk: lib/CodeGen/BackendUtil.cpp test/CodeGen/code-coverage.c
Bill Wendling
isanbard at gmail.com
Mon Dec 10 11:47:54 PST 2012
Author: void
Date: Mon Dec 10 13:47:53 2012
New Revision: 169755
URL: http://llvm.org/viewvc/llvm-project?rev=169755&view=rev
Log:
Specify if `-mno-red-zone' was used when creating the GCOV instrucmentation pass.
This prevents the functions generated by that pass from using the red zone.
<rdar://problem/12843084>
Added:
cfe/trunk/test/CodeGen/code-coverage.c
Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp
Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=169755&r1=169754&r2=169755&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Mon Dec 10 13:47:53 2012
@@ -294,7 +294,9 @@
if (CodeGenOpts.EmitGcovArcs || CodeGenOpts.EmitGcovNotes) {
MPM->add(createGCOVProfilerPass(CodeGenOpts.EmitGcovNotes,
CodeGenOpts.EmitGcovArcs,
- TargetTriple.isMacOSX()));
+ TargetTriple.isMacOSX(),
+ false,
+ CodeGenOpts.DisableRedZone));
if (CodeGenOpts.getDebugInfo() == CodeGenOptions::NoDebugInfo)
MPM->add(createStripSymbolsPass(true));
Added: cfe/trunk/test/CodeGen/code-coverage.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/code-coverage.c?rev=169755&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/code-coverage.c (added)
+++ cfe/trunk/test/CodeGen/code-coverage.c Mon Dec 10 13:47:53 2012
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -O0 -mno-red-zone -fprofile-arcs -ftest-coverage -emit-llvm %s -o - | FileCheck %s
+// <rdar://problem/12843084>
+
+int test1(int a) {
+ switch (a % 2) {
+ case 0:
+ ++a;
+ case 1:
+ a /= 2;
+ }
+ return a;
+}
+
+// Check tha the `-mno-red-zone' flag is set here on the generated functions.
+
+// CHECK: void @__llvm_gcov_indirect_counter_increment(i32* %{{.*}}, i64** %{{.*}}) unnamed_addr noinline noredzone
+// CHECK: void @__llvm_gcov_writeout() unnamed_addr noinline noredzone
+// CHECK: void @__llvm_gcov_init() unnamed_addr noinline noredzone
+// CHECK: void @__gcov_flush() unnamed_addr noinline noredzone
More information about the cfe-commits
mailing list