Greg Bedwell via llvm-dev
2018-May-30 18:29 UTC
[llvm-dev] [SROA][DebugInfo][GSoC] Testing SROA on amalgamated sqlite source
> > is in the business of deciding, but it does score it as a difference > because it now, at no point, sees the expression "first" evaluate to a > value of 5, or "total" to a value of 8 which it did previously. From the > source-level debugging experience, the variables now just get updated > between iterations. >Obviously should've been 7 for that value of "total". To try and be a bit more helpful there's definitely something dodgy happening to variable visibility on the fibonacci example in LICM. With "BISECT: NOT running pass (32) Loop Invariant Code Motion on loop": ## BEGIN ## [1, "main", "tests/fibonacci/test.cpp", 24, 6, "BREAKPOINT", "FUNC", {}] [2, "main", "tests/fibonacci/test.cpp", 25, 2, "BREAKPOINT", "FORWARD", {}] . [3, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 13, 20, "BREAKPOINT", "FUNC", {}] . [4, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 15, 20, "BREAKPOINT", "FORWARD", {"i": "0", "second": "1", "total": "0", "first": "0"}] . [5, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 16, 9, "BREAKPOINT", "FORWARD", {"i": "0", "second": "1", "total": "0", "first": "0", "next": "1"}] . [6, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 13, 29, "STEP", "BACKWARD", {}] . [7, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 15, 20, "BREAKPOINT", "FORWARD", {"i": "1", "second": "1", "total": "0", "first": "1"}] . [8, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 16, 9, "BREAKPOINT", "FORWARD", {"i": "1", "second": "1", "total": "0", "first": "1", "next": "2"}] . [9, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 13, 29, "STEP", "BACKWARD", {}] . [10, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 15, 20, "BREAKPOINT", "FORWARD", {"i": "2", "second": "2", "total": "1", "first": "1"}] . [11, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 16, 9, "BREAKPOINT", "FORWARD", {"i": "2", "second": "2", "total": "1", "first": "1", "next": "3"}] . [12, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 13, 29, "STEP", "BACKWARD", {}] . [13, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 15, 20, "BREAKPOINT", "FORWARD", {"i": "3", "second": "3", "total": "2", "first": "2"}] . [14, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 16, 9, "BREAKPOINT", "FORWARD", {"i": "3", "second": "3", "total": "2", "first": "2", "next": "5"}] . [15, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 13, 29, "STEP", "BACKWARD", {}] . [16, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 15, 20, "BREAKPOINT", "FORWARD", {"i": "4", "second": "5", "total": "4", "first": "3"}] . [17, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 16, 9, "BREAKPOINT", "FORWARD", {"i": "4", "second": "5", "total": "4", "first": "3", "next": "8"}] . [18, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 13, 29, "STEP", "BACKWARD", {}] . [19, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 20, 1, "BREAKPOINT", "FORWARD", {}] [20, "main", "tests/fibonacci/test.cpp", 26, 9, "BREAKPOINT", "FUNC", {}] ## END (20 steps) ## But with: "BISECT: running pass (32) Loop Invariant Code Motion on loop": ## BEGIN ## [1, "main", "tests/fibonacci/test.cpp", 24, 6, "BREAKPOINT", "FUNC", {}] [2, "main", "tests/fibonacci/test.cpp", 25, 2, "BREAKPOINT", "FORWARD", {}] . [3, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 13, 20, "BREAKPOINT", "FUNC", {}] . [4, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 16, 9, "BREAKPOINT", "FORWARD", {"i": "0", "second": "1", "total": "0", "first": "0", "next": null}] . [5, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 13, 2, "STEP", "BACKWARD", {}] . [6, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 15, 20, "BREAKPOINT", "FORWARD", {"i": "0", "second": "1", "total": "0", "first": "0"}] . [7, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 16, 9, "STEP", "FORWARD", {"i": "0", "second": "1", "total": "0", "first": "0", "next": "1"}] . [8, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 13, 29, "STEP", "BACKWARD", {}] . [9, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 15, 20, "BREAKPOINT", "FORWARD", {"i": "1", "second": "1", "total": "0", "first": "1"}] . [10, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 16, 9, "STEP", "FORWARD", {"i": "1", "second": "1", "total": "0", "first": "1", "next": "2"}] . [11, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 13, 29, "STEP", "BACKWARD", {}] . [12, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 15, 20, "BREAKPOINT", "FORWARD", {"i": "2", "second": "2", "total": "0", "first": "1"}] . [13, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 16, 9, "STEP", "FORWARD", {"i": "2", "second": "2", "total": "0", "first": "1", "next": "3"}] . [14, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 13, 29, "STEP", "BACKWARD", {}] . [15, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 15, 20, "BREAKPOINT", "FORWARD", {"i": "3", "second": "3", "total": "0", "first": "2"}] . [16, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 16, 9, "STEP", "FORWARD", {"i": "3", "second": "3", "total": "0", "first": "2", "next": "5"}] . [17, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 13, 29, "STEP", "BACKWARD", {}] . [18, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 15, 20, "BREAKPOINT", "FORWARD", {"i": "4", "second": "5", "total": "0", "first": "3"}] . [19, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 16, 9, "STEP", "FORWARD", {"i": "4", "second": "5", "total": "0", "first": "3", "next": "8"}] . [20, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 13, 29, "STEP", "BACKWARD", {}] . [21, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 16, 9, "STEP", "FORWARD", {"i": "5", "second": "8", "total": "0", "first": "5", "next": "8"}] . [22, "Fibonacci(int, int&)", "tests/fibonacci/test.cpp", 20, 1, "BREAKPOINT", "FORWARD", {}] [23, "main", "tests/fibonacci/test.cpp", 26, 9, "BREAKPOINT", "FUNC", {}] ## END (23 steps) ## The difference here that really sticks out as a problem to me is reported by the heuristic like this: test.cpp:15-18 [total] [21/21] expected encountered values: 0 missing values: 1 [+6] 2 [+6] 4 [+6] 7 [+3] So, "total" evaluates to 0 for the duration of Fibonacci(int, int&) which definitely smells wrong to me. Prior to that it was evaluating to 0, 1, 2 and 4 in order (we stopped seeing 7 after SROA). -Greg -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180530/157a1bc6/attachment-0001.html>
Anast Gramm via llvm-dev
2018-May-31 12:28 UTC
[llvm-dev] [SROA][DebugInfo][GSoC] Testing SROA on amalgamated sqlite source
Thanks, These are very helpful. As I understand it, SROA and LICM render some variables "useless" by optimizing the code to not use them. Hence we can't debug them.
Greg Bedwell via llvm-dev
2018-Jun-04 21:18 UTC
[llvm-dev] [SROA][DebugInfo][GSoC] Testing SROA on amalgamated sqlite source
FWIW, I've raised the LICM issue here: https://bugs.llvm.org/show_bug.cgi?id=37682 On 31 May 2018 at 13:28, Anast Gramm <anastasis.gramm2 at gmail.com> wrote:> Thanks, > These are very helpful. > > As I understand it, SROA and LICM render some variables > "useless" by optimizing the code to not use them. Hence we can't debug > them. > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180604/7c2861e7/attachment.html>
Reasonably Related Threads
- [SROA][DebugInfo][GSoC] Testing SROA on amalgamated sqlite source
- [SROA][DebugInfo][GSoC] Testing SROA on amalgamated sqlite source
- [SROA][DebugInfo][GSoC] Testing SROA on amalgamated sqlite source
- [GSoC 2018] Application - Improve Debugging of Optimized Code
- [SROA][DebugInfo][GSoC] Testing SROA on amalgamated sqlite source