<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 - Variable's value late availability after VectorCombinePass at Os"
   href="https://bugs.llvm.org/show_bug.cgi?id=51942">51942</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Variable's value late availability after VectorCombinePass at Os
          </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>A variable (l_113) value is visile after its declarations and it becomes
available only at line 11.
>From opt-bisect, it seems that the pass after which this behaviour occurs is: 
VectorCombinePass on function (main)

$ cat a.c
int a,  b,  g   ;
int *c = &a;
char d,  e,  f   ;
void  h(i) {
  int l_113 = 9;
  d = *c |=   
                     f =
                                       e      
                                  <= 5  ;
    int *l_80 = b;
    g = *c || *l_80  ^ i;

}
int main() 
  {
       h(5);
  }

$ 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 -g -Os -o opt a.c
$ lldb opt
(lldb) target create "opt"
Current executable set to
'/home/stepping/debuginfo-analysis/issues/issue15/opt' (x86_64).
(lldb) b h
Breakpoint 1: where = opt`h at a.c:9:35, address = 0x0000000000400478
(lldb) r
Process 40 launched: '/home/stepping/debuginfo-analysis/issues/issue15/opt'
(x86_64)
Process 40 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400478 opt`h(i=5) at a.c:9:35
   6      d = *c |=   
   7                         f =
   8                                           e      
-> 9                                      <= 5  ;
   10       int *l_80 = b;
   11       g = *c || *l_80  ^ i;
   12     
(lldb) frame var
(int) i = 5
(int) l_113 = <variable not available>

(int *) l_80 = <variable not available>

(lldb) s
Process 40 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x0000000000400481 opt`h(i=5) at a.c:7:24
   4    void  h(i) {
   5      int l_113 = 9;
   6      d = *c |=   
-> 7                         f =
   8                                           e      
   9                                      <= 5  ;
   10       int *l_80 = b;
(lldb) frame var
(int) i = 5
(int) l_113 = <variable not available>

(int *) l_80 = <variable not available>

(lldb) s
Process 40 stopped
* thread #1, name = 'opt', stop reason = step in
    frame #0: 0x0000000000400488 opt`h(i=5) at a.c:9:35
   6      d = *c |=   
   7                         f =
   8                                           e      
-> 9                                      <= 5  ;
   10       int *l_80 = b;
   11       g = *c || *l_80  ^ i;
   12     
(lldb) frame var
(int) i = 5
(int) l_113 = <variable not available>

(int *) l_80 = <variable not available>

(lldb) n
Process 40 stopped
* thread #1, name = 'opt', stop reason = step over
    frame #0: 0x000000000040048b opt`h(i=5) at a.c:6:8
   3    char d,  e,  f   ;
   4    void  h(i) {
   5      int l_113 = 9;
-> 6      d = *c |=   
   7                         f =
   8                                           e      
   9                                      <= 5  ;
(lldb) n
Process 40 stopped
* thread #1, name = 'opt', stop reason = step over
    frame #0: 0x00000000004004a1 opt`h(i=5) at a.c:11:12
   8                                           e      
   9                                      <= 5  ;
   10       int *l_80 = b;
-> 11       g = *c || *l_80  ^ i;
   12     
   13   }
   14   int main() 
(lldb) frame var
(int) i = 5
(int) l_113 = 9
(int *) l_80 = <variable not available></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>