Patch by @wecing (Chenguang Wang).
authorTim Shen <timshen@google.com>
Fri, 19 Feb 2021 20:19:34 +0000 (12:19 -0800)
committerTim Shen <timshen@google.com>
Fri, 19 Feb 2021 20:44:17 +0000 (12:44 -0800)
commita0757d8ebdefa1c54896d70d2a04f68fc23f7916
tree43efc6e3c6b549073f26395fdaa1080ea43c6a45
parentf99ccf6516bdd5def4d3bc311330aec92f5cb99d
Patch by @wecing (Chenguang Wang).

The current getFoldedSizeOf() implementation uses naive recursion, which
could be really slow when the input structure type is too complex.

This issue was first brought up in
http://llvm.org/bugs/show_bug.cgi?id=8281; this change fixes it by
adding memoization.

Differential Revision: https://reviews.llvm.org/D6594
llvm/lib/IR/ConstantFold.cpp
llvm/test/tools/llvm-as/slow-ptrtoint.ll [new file with mode: 0644]