[llvm-bugs] [Bug 49143] New: The -finstrument-functions is not enabled with -O0
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Feb 11 03:35:25 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49143
Bug ID: 49143
Summary: The -finstrument-functions is not enabled with -O0
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Driver
Assignee: unassignedclangbugs at nondot.org
Reporter: adhemerval.zanella at linaro.org
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
The 'foo' function below is not instrumented when built with -O0, only when
using higher optimization options (such as -O1):
---
$ ./bin/clang -v 2>&1 | head -n2
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
90081f3020e38727eb30506d052cbb4e3a489eb6)
Target: aarch64-unknown-linux-gnu
$ cat test.c
void foo ()
{
}
static int count;
__attribute__ ((noinline)) __attribute__ ((no_instrument_function))
void __cyg_profile_func_enter (void *fn, void *parent)
{
count++;
}
__attribute__ ((noinline)) __attribute__ ((no_instrument_function))
void __cyg_profile_func_exit (void *fn, void *parent)
{
count++;
}
$ ./bin/clang -O0 -finstrument-functions -S -emit-llvm test.c -S -o - | head -n
12
$ ./bin/clang -O1 -finstrument-functions -S -emit-llvm test.c -S -o - | head -n
14
; ModuleID = 'test.c'
source_filename = "test.c"
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown-linux-gnu"
@count = internal unnamed_addr global i32 0, align 4
; Function Attrs: nofree norecurse nounwind uwtable willreturn
define dso_local void @foo() local_unnamed_addr #0 {
entry:
call void @__cyg_profile_func_enter(i8* undef, i8* undef)
call void @__cyg_profile_func_exit(i8* undef, i8* undef)
ret void
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210211/0d69b1e1/attachment.html>
More information about the llvm-bugs
mailing list