I noticed that clang miscompiled a C code generated from brainfxxk-to-C transpiler
(https://godbolt.org/z/676Grr), under -O1 or higher, a loop is wrongly optimized
into a dead loop.
After investigation, it turned out that the cause of the issue is that CSE w/
memorySSA transformation pass wrongly eliminated a --(*ptr) in the loop using
the result of another --(*ptr) outside the loop, without realizing that *ptr
may have been modified by the loop.
By bisecting the git history, it turned out that the bug was introduced by D59315.
The said diff seems to be a refactoring diff, however, it seems like the author
accidentally removed two lines of logic in refactoring, resulting in the bug.
I added the two lines back. While it solves the correctness issue, I'm not certain
on the performance implications of this change, since by clearing the AAQI after
each alias query, perhaps we would lose most of the gain from batching AA queries.
During the investigation, I also noticed that the author forgot to change a few
places to use his new API, however, I'm not sure if it is a correctness issue
or not.
clang-format not found in user's PATH; not linting file.