-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Labels
Description
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-optimizedprovides a high-level overview of the optimized code.-fdump-tree-optimized-blocks-detailsprovides 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.optimizedUsing -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.