<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 - Missing variables after SimplifyCFG at O2"
   href="https://bugs.llvm.org/show_bug.cgi?id=51782">51782</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missing variables after SimplifyCFG at O2
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>DebugInfo
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>cristianassaiante@outlook.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Upon calling a function from an external module, the first 9 variables passed
to it are not visible from lldb. Using -opt-bisect-limit we discovered that the
pass causing the symbols disappear is "SimplifyCFGPass on function (main)"

$ cat a.c
int b ;
static int a()
{
char l_287 = 1,  l_342 = 5;
int l_326 = 0,  l_341 = 1,  l_363 = 0,  l_387 = 3,  l_436 = 0,  i, j;
short l_343 = 3,  l_412 = 0,  l_413 = 1;
i = 0;
for (; i < 2; i++)
{
j = 0;
for (; j < 7; j++)
{
test_nop();
test_support_3073(l_287, l_326, l_341, l_342, l_343, l_363, l_387, l_412,
l_413, l_436, i, j);
}
}
}
int main ()
{
for (; b < 10; b++)
a();
}

$ cat lib/test.c
#include <stdio.h>
#include <stdint.h>
#include "test.h"

void test_nop() {
    printf("\n");
}

void test_support_3073(int l_287, int l_326, int l_341, int l_342, int l_343,
int l_363, int l_387, int l_412, int l_413, int l_436, int i, int j) {
    printf("%d %d %d %d %d %d %d %d %d %d %d %d", l_287, l_326, l_341, l_342,
l_343, l_363, l_387, l_412, l_413, l_436, i, j);

}

$ cat lib/test.h
#pragma once

void test_nop();

void test_support_3073(int l_287, int l_326, int l_341, int l_342, int l_343,
int l_363, int l_387, int l_412, int l_413, int l_436, int i, int j);

$ clang -v
clang version 13.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

$ lldb -v
lldb version 13.0.0

clang revision c2c977ce50597b0e5186afc342c5784bd0aa6973
lldb revision c2c977ce50597b0e5186afc342c5784bd0aa6973

$ clang -g -O2 -o opt lib/test.c a.c
$ lldb opt
(lldb) target create "opt"
Current executable set to '/home/cristianrichie/276/reduce/opt' (x86_64).
(lldb) b 13
Breakpoint 1: where = opt`main + 32 [inlined] a at a.c:13:1, address =
0x0000000000401160
(lldb) r
Process 2122 launched: '/home/cristianrichie/276/reduce/opt' (x86_64)
Process 2122 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
    frame #0: 0x0000000000401160 opt`main [inlined] a at a.c:13:1
   10   j = 0;
   11   for (; j < 7; j++)
   12   {
-> 13   test_nop();
   14   test_support_3073(l_287, l_326, l_341, l_342, l_343, l_363, l_387,
l_412, l_413, l_436, i, j);
   15   }
   16   }
(lldb) frame var
(int) i = 0
(int) j = 0
(lldb) frame var l_287
error: no variable named 'l_287' found in this frame
(lldb) frame var l_326
error: no variable named 'l_326' found in this frame
(lldb) frame var l_341
error: no variable named 'l_341' found in this frame
(lldb) frame var l_342
error: no variable named 'l_342' found in this frame
(lldb) frame var l_343
error: no variable named 'l_343' found in this frame
(lldb) frame var l_363
error: no variable named 'l_363' found in this frame
(lldb) frame var l_387
error: no variable named 'l_387' found in this frame
(lldb) frame var l_412
error: no variable named 'l_412' found in this frame
(lldb) frame var l_413
error: no variable named 'l_413' found in this frame</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>