[all-commits] [llvm/llvm-project] 2007dc: Reapply [Metadata] Preserve MD_prof when merging i...

Snehasish Kumar via All-commits all-commits at lists.llvm.org
Thu Apr 17 08:22:40 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2007dcfeb86fe272fcd16283f9bca45292e3c630
      https://github.com/llvm/llvm-project/commit/2007dcfeb86fe272fcd16283f9bca45292e3c630
  Author: Snehasish Kumar <snehasishk at google.com>
  Date:   2025-04-17 (Thu, 17 Apr 2025)

  Changed paths:
    M llvm/lib/IR/Metadata.cpp
    M llvm/lib/Transforms/Utils/Local.cpp
    A llvm/test/Transforms/GVN/pre-invalid-prof-metadata.ll
    A llvm/test/Transforms/SimplifyCFG/merge-direct-call-branch-weights-preserve-hoist.ll
    A llvm/test/Transforms/SimplifyCFG/merge-direct-call-branch-weights-preserve-sink.ll

  Log Message:
  -----------
  Reapply [Metadata] Preserve MD_prof when merging instructions when one is missing. (#135418)

Preserve branch weight metadata when merging instructions if one of the
instructions is missing metadata. This is similar in behaviour to what
we do today for other types of metadata such as mmra, memprof and
callsite metadata.

Also add a legality check when merging prof metadata based on
instruction type. Without this check GVN PRE optimizations result in
prof metadata on phi nodes which break the module verifier.

Build failure caught by
https://lab.llvm.org/buildbot/#/builders/113/builds/6621
```
!9185 = !{!"branch_weights", i32 3912, i32 802}
Wrong number of operands
!9185 = !{!"branch_weights", i32 3912, i32 802}
fatal error: error in backend: Broken module found, compilation aborted!
```

Reverts #134200 with additional changes.



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