Add a flag that disables caching when computing aliasing results potentially based on a phi-phi NoAlias assumption. We'll still insert cache entries temporarily to catch infinite recursion, but will drop them afterwards, so they won't persist in BatchAA.
Rebase. I've committed the not-really-related change that lead to the compile-time improvement separately. With that gone, the new numbers are: https://llvm-compile-time-tracker.com/compare.php?from=6f5ef648a57aed3274118dcbd6467e8ac4f6ed1f&to=50d73a31620111c4298cc336ac4682ef7585ed6b&stat=instructions Which does make this a mild compile-time regression, but not too bad.
I've hit a case where this causes compilation to hang indefinitely (or so it seems; the case earlier compiled in around 2 seconds, and now hasn't finished after at least 7 minutes), with https://martin.st/temp/dvdec-preproc.c compiled with clang -target x86_64-w64-mingw32 -w -c -O3 dvdec-preproc.c.
This will clearly need something more sophisticated. After thinking this over, I also think that the current approach of inserting assumptions at phis is not optimal, as the tests added in https://github.com/llvm/llvm-project/commit/b5e8de9c7903d458b098a8af03939384270c1a5e show. I expect this can also result in BatchAA returning different results, depending on whether a gep or a phi is visited first. We should be inserting everything as NoAlias into the cache in the first place and tracking whether that assumption gets used or not.