Skip to content

C++ target fails Performance/DropLoopEntryBranchInLRRule_4.txt #3959

@parrt

Description

@parrt

It hits nonlinearity OR it is merging incorrectly. I suspect the latter.

Run

$ cd ~/antlr/code/antlr4/runtime/Cpp
$ cmake . -DTRACE_ATN=ON -DCMAKE_BUILD_TYPE=Debug
$ make  # which makes dist/libantlr4-runtime.dylib

Unzip the file test.zip into a test dir to get test. Then from test dir:

$ ln -s ~/antlr/code/antlr4/runtime/Cpp/dist/libantlr4-runtime.dylib 
$ clang++ -g -std=c++17 -I /Users/parrt/antlr/code/antlr4/runtime/Cpp/runtime/src -L. -lantlr4-runtime *.cpp
$ ./a.out input

Comparing Java / C++ trace, we see Java reuses a context but C++ doesn't:

Screen Shot 2022-11-13 at 5 50 43 PM

If we have merged #3817 then you can get with output this assuming ~/tmp/bug/input is your test dir:

$ ~/antlr/code/antlr4/runtime-testsuite
$ bash ~/antlr/code/antlr4/scripts/traceatn.sh ~/tmp/bug/T.g4 stat -target Java ~/tmp/bug/input > /tmp/java
$ bash ~/antlr/code/antlr4/scripts/traceatn.sh ~/tmp/bug/T.g4 stat -target Cpp ~/tmp/bug/input > /tmp/cpp
$ diff /tmp/java /tmp/cpp

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions