msabi: Fix exponential mangling time for certain pathological inputs
authorNico Weber <nicolasweber@gmx.de>
Sat, 1 Jun 2019 10:12:07 +0000 (10:12 +0000)
committerNico Weber <nicolasweber@gmx.de>
Sat, 1 Jun 2019 10:12:07 +0000 (10:12 +0000)
commit73f05841992c5a70631968029e526c6a571383bf
treeedf9a0476f061510cd1583f03bbbaf91c653ce40
parent46d4dba6e64eb47dfa04beb8d9c623a29b3375df
msabi: Fix exponential mangling time for certain pathological inputs

Template back references used to be recursively recomputed, add a
memoization cache to cut down on this.

Since there are now two different types of argument maps, rename the
existing TypeBackReferences to FunArgBackReferences, and rename
mangleArgumentType() to mangleFunctionArgumentType().

Fixes PR42091, the input there now takes 50ms instead of 7s to compile.

No intended behavior change.

Differential Revision: https://reviews.llvm.org/D62746

llvm-svn: 362293
clang/lib/AST/MicrosoftMangle.cpp
clang/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp