llvm-project/llvm/test/tools/llvm-reduce
Michael Kruse d9562a8e45 [llvm-reduce] Reduce metadata references.
The ReduceMetadata pass before this patch removed metadata on a per-MDNode (or NamedMDNode) basis. Either all references to an MDNode are kept, or all of them are removed. However, MDNodes are uniqued, meaning that references to MDNodes with the same data become references to the same MDNodes. As a consequence, e.g. tbaa references to the same type will all have the same MDNode reference and hence make it impossible to reduce only keeping metadata on those memory access for which they are interesting.
Moreover, MDNodes can also be referenced by some intrinsics or other MDNodes. These references were not considered for removal leading to the possibility that MDNodes are not actually removed even if selected to be removed by the oracle.

This patch changes ReduceMetadata to reduces based on removable metadata references instead. MDNodes without references implicitly dropped anyway. References by intrinsic calls should be removed by ReduceOperands or ReduceInstructions. References in other MDNodes cannot be removed as it would violate the immutability of MDNodes.

Additionally, ReduceMetadata pass before this patch used `setMetadata(I, NULL)` to remove references, where `I` is the index in the array returned by `getAllMetadata`. However, `setMetadata` expects a MDKind (such as `MD_tbaa`) as first argument. `getAllMetadata` does not return those in consecutive order (otherwise it would not need to be a `std::pair` with `first` representing the MDKind).

Reviewed By: aeubanks, swamulism

Differential Revision: https://reviews.llvm.org/D110534
2021-09-29 11:25:35 -05:00
..
Inputs
custom-delta-passes.ll [llvm-reduce] Remove various module data 2021-08-24 09:45:31 -07:00
do-not-remove-terminator.ll
fail-file-open.test [llvm-reduce] Exit when input module is malformed 2021-05-25 10:01:12 -07:00
help.test [llvm][tools] Hide remaining unrelated llvm- tool options 2021-07-22 09:47:55 +02:00
no-replace-intrinsic-callee-with-undef.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-alias.ll
remove-all-of-multiple-args.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-args-2.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-args-dbg-intrinsics.ll [llvm-reduce] Don't delete arguments of intrinsics 2021-06-21 12:43:58 -07:00
remove-args-from-declaration.ll
remove-args-used-by-ret.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-args.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-attributes-from-intrinsic-like-functions.ll
remove-attributes-from-intrinsics.ll
remove-bbs-ret-nonvoid.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-bbs-unwinded-to.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-bbs.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-call-site-attributes.ll
remove-dso-local.ll [llvm-reduce] Don't unset dso_local on implicitly dso_local GVs 2021-04-30 11:57:22 -07:00
remove-funcs.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-function-arguments-of-funcs-used-in-blockaddress.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-function-attributes.ll
remove-function-bodies-comdat.ll
remove-function-bodies-used-in-globals.ll
remove-function-bodies.ll
remove-global-variable-attributes.ll
remove-global-vars.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-instructions.ll
remove-invoked-functions.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-metadata-args.ll [llvm-reduce] Reduce metadata references. 2021-09-29 11:25:35 -05:00
remove-metadata.ll
remove-module-data.ll [llvm-reduce] Remove various module data 2021-08-24 09:45:31 -07:00
remove-multiple-use-of-args-in-same-instruction.ll
remove-multiple-use-of-global-vars-in-same-instruction.ll
remove-operand-bundles.ll
remove-operands.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-single-arg.ll [llvm-reduce] Add reduce operands pass 2021-09-17 12:32:15 -07:00
remove-unused-declarations.ll