Skip to content

Missing line information after EarlyCSE and InstCombine pass at Og #49818

@cristianassaiante

Description

@cristianassaiante
Bugzilla Link 50475
Version trunk
OS Linux
CC @JDevlieghere,@jmorse,@walkerkd,@OCHyams,@pogo59

Extended Description

The last assignment to a variable passed to an external function is not reached in debugging. If we put a breakpoint on line 14, after a next command we end up in line 17 thus skipping lines 15 and 16 where the last assignment to v_0 and v_1 is done. From opt-bisect, the pass after which line 15 is not reached anymore is EarlyCSEPass and the pass after which line 16 is not reached anymore is InstCombinePass.

$ cat a.c
int test_in();
void test_out(int v_0, int v_1, int v_2, int v_3);

int main (void)
{
int v_0, v_1, v_2, v_3;
v_0 = test_in();
v_1 = test_in();
v_2 = test_in();
v_3 = test_in();
v_1 = (!v_1 > (v_2 - (v_3 <= v_0)));
v_0 = (v_1 < (~v_2 <= (v_3 >= v_0)));

v_3 = ((v_2 + v_3) >= v_0);
v_0 = (v_2 | (!(v_3 * v_0) < v_1));
v_1 = (v_3 % !(~!v_0 >= (v_2 + v_1)));
test_out(v_0, v_1, v_2, v_3);
return 0;

}

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

int ctr = 0;

int test_in() {
return ctr++;
}

void test_out(int v_0, int v_1, int v_2, int v_3) {
printf("%d%d%d%d", v_0, v_1, v_2, v_3);
}

$ 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 c2c977c
lldb revision c2c977c

$ clang -g -Og -o opt lib/test.c a.c
$ lldb opt
(lldb) target create "opt"
Current executable set to '/home/stepping/test/opt' (x86_64).
(lldb) b 14
Breakpoint 1: where = opt`main + 83 at a.c:14:14, address = 0x0000000000400553
(lldb) r
Process 155 launched: '/home/stepping/test/opt' (x86_64)
Process 155 stopped

  • thread #​1, name = 'opt', stop reason = breakpoint 1.1
    frame #​0: 0x0000000000400553 opt`main at a.c:14:14
    11 v_1 = (!v_1 > (v_2 - (v_3 <= v_0)));
    12 v_0 = (v_1 < (v_2 <= (v_3 >= v_0)));
    13
    -> 14 v_3 = ((v_2 + v_3) >= v_0);
    15 v_0 = (v_2 | (!(v_3 * v_0) < v_1));
    16 v_1 = (v_3 % !(
    !v_0 >= (v_2 + v_1)));
    17 test_out(v_0, v_1, v_2, v_3);
    (lldb) next
    Process 155 stopped
  • thread #​1, name = 'opt', stop reason = step over
    frame #​0: 0x000000000040055c opt`main at a.c:17:2
    14 v_3 = ((v_2 + v_3) >= v_0);
    15 v_0 = (v_2 | (!(v_3 * v_0) < v_1));
    16 v_1 = (v_3 % !(~!v_0 >= (v_2 + v_1)));
    -> 17 test_out(v_0, v_1, v_2, v_3);
    18 return 0;
    19 }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions