[NFC] Add a test case to make sure EarlyCSE preserves !prof when one
authorMingming Liu <mingmingl@google.com>
Fri, 28 Apr 2023 00:49:41 +0000 (17:49 -0700)
committerMingming Liu <mingmingl@google.com>
Wed, 3 May 2023 00:34:53 +0000 (17:34 -0700)
commitbb4ba96ed2bd8ca7cc902abb07385a4058fe3ee6
tree836ab2434b6ffea5b770a6eed08bcf6c6d8101fa
parent297c10fd175a2f0ff7cb293fcb2d149b065eaabe
[NFC] Add a test case to make sure EarlyCSE preserves !prof when one
instruction CSE'ed another.

- This should be a part of D148877. Before that patch, !prof is not added to known-id-set [1], and turns out unknown types of metadata are dropped in the implementation [2].
  - This test is mainly added to make sure there won't be regressions for this kind of pattern. The pattern is observed it in application code; looks like the result of indirect call is used as function arguments initially; after the function is inlined load-after-store CSE opportunity is exposed.

  [1] https://github.com/llvm/llvm-project/blob/f478721231bdb71ba8f0f6fb21673b9b7f652add/llvm/lib/Transforms/Utils/Local.cpp#L2727-L2741
  [2] https://github.com/llvm/llvm-project/blob/ade3c6a6a88ed3a9b06c076406f196da9d3cc1b9/llvm/lib/Transforms/Utils/Local.cpp#L2639

Differential Revision: https://reviews.llvm.org/D149396
llvm/test/Transforms/EarlyCSE/metadata.ll [new file with mode: 0644]