[llvm-bugs] [Bug 35412] New: LLVM ERROR when using flto, debug and instrument-functions after r318199

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 24 07:55:59 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35412

            Bug ID: 35412
           Summary: LLVM ERROR when using flto, debug and
                    instrument-functions after r318199
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: ilia.taraban at intel.com
                CC: llvm-bugs at lists.llvm.org

This test fails at compilation when using "flto", "g" and
"finstrument-functions" after 318199 revision:

================= nice.c ==============
int main()
{
  return 0;
}
=======================================


============ profile_funcs.c ==========
void __cyg_profile_func_enter (void *this_fn, void *call_site) {}
void __cyg_profile_func_exit  (void *this_fn, void *call_site) {}

=======================================

>>> clang -v
clang version 6.0.0 (trunk 318198)
Target: x86_64-unknown-linux-gnu
Thread model: posix
...

>>> clang -c -g -flto -finstrument-functions nice.c
>>> clang -c -g -flto profile_funcs.c
>>> clang -g -flto nice.o profile_funcs.o

=============== nice.o.ll =============
...
define i32 @main() #0 !dbg !7 {
entry:
  %retval = alloca i32, align 4
  %callsite = call i8* @llvm.returnaddress(i32 0), !dbg !11
  call void @__cyg_profile_func_enter(i8* bitcast (i32 ()* @main to i8*), i8*
%callsite) #2, !dbg !11
  store i32 0, i32* %retval, align 4
  store i32 0, i32* %retval, align 4, !dbg !12
  %callsite1 = call i8* @llvm.returnaddress(i32 0), !dbg !11
  call void @__cyg_profile_func_exit(i8* bitcast (i32 ()* @main to i8*), i8*
%callsite1) #2, !dbg !11
  %0 = load i32, i32* %retval, align 4, !dbg !12
  ret i32 %0, !dbg !12
}
...
=======================================

Now let's look after commit: 
>>> clang -v
clang version 6.0.0 (trunk 318199)
Target: x86_64-unknown-linux-gnu
Thread model: posix
...

>>> clang -c -g -flto -finstrument-functions nice.c
>>> clang -c -g -flto profile_funcs.c
>>> clang -g -flto nice.o profile_funcs.o
inlinable function call in a function with debug info must have a !dbg location
  call void @__cyg_profile_func_enter(i8* bitcast (i32 ()* @main to i8*), i8*
%1)
inlinable function call in a function with debug info must have a !dbg location
  call void @__cyg_profile_func_exit(i8* bitcast (i32 ()* @main to i8*), i8*
%3)
inlinable function call in a function with debug info must have a !dbg location
  call void @__cyg_profile_func_enter(i8* bitcast (i32 ()* @main to i8*), i8*
%1)
inlinable function call in a function with debug info must have a !dbg location
  call void @__cyg_profile_func_exit(i8* bitcast (i32 ()* @main to i8*), i8*
%3)
LLVM ERROR: Broken module found, compilation aborted!
clang-6.0: error: linker command failed with exit code 1 (use -v to see
invocation)

=============== nice.o.ll =============
...
define i32 @main() #0 !dbg !7 {
entry:
  %0 = call i8* @llvm.returnaddress(i32 0)
  call void @__cyg_profile_func_enter(i8* bitcast (i32 ()* @main to i8*), i8*
%0)
  %retval = alloca i32, align 4
  store i32 0, i32* %retval, align 4
  %1 = call i8* @llvm.returnaddress(i32 0)
  call void @__cyg_profile_func_exit(i8* bitcast (i32 ()* @main to i8*), i8*
%1)
  ret i32 0, !dbg !11
}
...
=======================================

-- 
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/20171124/877c24c2/attachment-0001.html>


More information about the llvm-bugs mailing list