Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update-threading.c: "Invalid sum" found #638

Open
luismgsilva opened this issue Jul 17, 2024 · 0 comments
Open

update-threading.c: "Invalid sum" found #638

luismgsilva opened this issue Jul 17, 2024 · 0 comments
Assignees
Milestone

Comments

@luismgsilva
Copy link
Member

luismgsilva commented Jul 17, 2024

original test case

The test case verifies that when compiled with optimization levels, the compiler optimizes the code correctly without producing any unwanted "Invalid sum" messages in the optimized tree dump.

Last year, the GCC options for this test case were updated from -fdump-tree-optimized to -fdump-tree-optimized-blocks-details in a patch.

  • -fdump-tree-optimized provides a high-level overview of the optimized code.
  • -fdump-tree-optimized-blocks-details provides a detailed view of the basic blocks within the optimized code

With this update, the test case now fails, showing two instances of "Invalid sum." The issue was already present but was not visible due to the lack of the blocks-details suffix in the previous GCC option.

Using -fdump-tree-optimized

$ module load arc-2023.09
$ arc-elf32-gcc \
        update-threading.c          \
        -mcpu=archs                 \
        -fdiagnostics-plain-output  \
        -O2                         \
        -fdump-tree-optimized       \
        -S                          \
        --specs=hl.specs            \
        -o update-threading.s
$ grep "Invalid sum" update-threading.c.254t.optimized

Using -fdump-tree-optimized-blocks-detailed

$ module load arc-2023.09
$ arc-elf32-gcc \
        update-threading.c                  \
        -mcpu=archs                         \
        -fdiagnostics-plain-output          \
        -O2                                 \
        -fdump-tree-optimized-blocks-details    \
        -S                                  \
        --specs=hl.specs                    \
        -o update-threading.s
$ grep "Invalid sum" update-threading.c.254t.optimized
;;   Invalid sum of incoming counts 708669600 (estimated locally), should be 0 (precise)
;;   Invalid sum of incoming counts 365072224 (estimated locally), should be 1073741824 (estimated locally)

The two "Invalid sum of incoming counts" messages reveal discrepancies in the compiler's block count estimations during the optimization process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants