<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - LLVM ERROR when using flto, debug and instrument-functions after r318199"
   href="https://bugs.llvm.org/show_bug.cgi?id=35412">35412</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLVM ERROR when using flto, debug and instrument-functions after r318199
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ilia.taraban@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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) {}

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

<span class="quote">>>> clang -v</span >
clang version 6.0.0 (trunk 318198)
Target: x86_64-unknown-linux-gnu
Thread model: posix
...

<span class="quote">>>> clang -c -g -flto -finstrument-functions nice.c
>>> clang -c -g -flto profile_funcs.c
>>> clang -g -flto nice.o profile_funcs.o</span >

=============== 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: 
<span class="quote">>>> clang -v</span >
clang version 6.0.0 (trunk 318199)
Target: x86_64-unknown-linux-gnu
Thread model: posix
...

<span class="quote">>>> clang -c -g -flto -finstrument-functions nice.c
>>> clang -c -g -flto profile_funcs.c
>>> clang -g -flto nice.o profile_funcs.o</span >
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
}
...
=======================================</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>