[llvm-bugs] [Bug 51734] New: Missing variables after loop strength reduction at Og

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 3 07:25:00 PDT 2021


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

            Bug ID: 51734
           Summary: Missing variables after loop strength reduction at Og
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: cristianassaiante at outlook.com
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

Upon calling a function from an external module, the variable l_75 passed to it
is not visible from lldb. Using -opt-bisect-limit we discovered that the pass
causing the symbols disappear is "Loop Strength Reduction on loop".

$ cat a.c
void  a()
{
char b = 0,  l_78 = 1;
int l_49 = 2;
short l_55 = 3,  l_75 = 3;
for (; b <= 8; ++b)
{
test_nop();
test_support_2996(l_49, l_55, l_75, l_78);
l_75 = 0;
}
}
int main ()
{
a();
}

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

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

void test_support_2996(int l_49, int l_55, int l_75, int l_78) {
    printf("%d %d %d %d", l_49, l_55, l_75, l_78);
}

$ cat lib/test.h
#pragma once

void test_nop();
void test_support_2996(int l_49, int l_55, int l_75, int l_78);

$ 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 -O3 -o opt lib/test.c a.c
$ lldb opt
(lldb) target create "opt"
Current executable set to '/home/cristianrichie/71/reduce/opt' (x86_64).
(lldb) b 8
Breakpoint 1: 2 locations.
(lldb) r
Process 4253 launched: '/home/cristianrichie/71/reduce/opt' (x86_64)
Process 4253 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.2
    frame #0: 0x0000000000401190 opt`main [inlined] a at a.c:8:1
   5    short l_55 = 3,  l_75 = 3;
   6    for (; b <= 8; ++b)
   7    {
-> 8    test_nop();
   9    test_support_2996(l_49, l_55, l_75, l_78);
   10   l_75 = 0;
   11   }
(lldb) frame var
(short) l_55 = 3
(int) l_49 = 2
(char) l_78 = '\x01'
(lldb) frame var l_75
error: no variable named 'l_75' found in this frame

-- 
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/20210903/74965afb/attachment.html>


More information about the llvm-bugs mailing list