aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2024-02-19 23:23:57 -0800
committerOwen Pan <owenpiano@gmail.com>2024-02-20 00:28:26 -0800
commit119a72866f0e143127355fe6e03f57c4f8bab1ae (patch)
tree958b7a59ad70190497247cbe7111b9fb41666600 /llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
parent1cbe26d302ca7d3573c1bf43114dfd7d2f0ca476 (diff)
downloadllvm-119a72866f0e143127355fe6e03f57c4f8bab1ae.zip
llvm-119a72866f0e143127355fe6e03f57c4f8bab1ae.tar.gz
llvm-119a72866f0e143127355fe6e03f57c4f8bab1ae.tar.bz2
[clang-format][NFC] Remove redundant calls to guessIsObjC()
Running clang-format on the following input ``` int lambdas() { return [&] { return [&] { return [&] { return [&] { return [&] { return [&] { return [&] { return 3; } (); } (); } (); } (); } (); } (); } (); } ``` will finish instantly if you pass clang-format a .cpp input with this content, but hang for tens of seconds if you pass the same via stdin or a .h file. Adding some debug statements showed that guessIsObjC was getting called tens of millions of times in a manner that scales very rapidly with the amount of nesting (if clang-format just takes a few seconds with that input passed on stdin, try adding a couple more levels of nesting). This change moves the recursive guessIsObjC call one level of nesting out of an inner loop whose iterations don't affect the input to the recursive call. This resolves the performance issue. Authored-by: davidvc1 and Uran198 Differential Revision: https://reviews.llvm.org/D114837 Differential Revision: https://reviews.llvm.org/D47515
Diffstat (limited to 'llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp')
0 files changed, 0 insertions, 0 deletions