[all-commits] [llvm/llvm-project] aa612f: [NFC][Cloning] Replace DIFinder usage in CloneFunc...

Artem Pianykh via All-commits all-commits at lists.llvm.org
Thu Mar 13 10:18:33 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aa612f3ade66b5dd3e95d028c0345a94c38e1ff8
      https://github.com/llvm/llvm-project/commit/aa612f3ade66b5dd3e95d028c0345a94c38e1ff8
  Author: Artem Pianykh <artem.pyanykh at gmail.com>
  Date:   2025-03-13 (Thu, 13 Mar 2025)

  Changed paths:
    M llvm/lib/Transforms/Utils/CloneFunction.cpp

  Log Message:
  -----------
  [NFC][Cloning] Replace DIFinder usage in CloneFunctionInto with a MetadataPredicate (#129148)


Summary:
The new code should be functionally identical to the old one (but
faster). The reasoning is as follows.

In the old code when cloning within the module:
1. DIFinder traverses and collects *all* debug info reachable from a
   function, its instructions, and its owning compile unit.
2. Then "compile units, types, other subprograms, and lexical blocks of
   other subprograms" are saved in a set.
3. Then when we MapMetadata, we traverse the function's debug info
   _again_ and those nodes that are in the set from p.2 are identity
   mapped.

This looks equivalent to just doing step 3 with identity mapping based
on a predicate that says to identity map "compile units, types, other
subprograms, and lexical blocks of other subprograms" (same as in step
2). This is what the new code does.

Test Plan:
ninja check-all
There's a bunch of tests around cloning and all of them pass.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list