[PATCH] D101141: [SimplifyCFG] Preserve metadata when unconditionalizing branches (constant condition).

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 00:20:45 PDT 2021


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

This LGTM, thank you.



================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:175
+
+      // Transfer the metadata to the new branch instruction.
+      for (const auto &MDPair : BranchMetadata) {
----------------
Meinersbur wrote:
> lebedev.ri wrote:
> > Meinersbur wrote:
> > > lebedev.ri wrote:
> > > > What about prof md?
> > > Edge weights are not in the scope of this patch.
> > Indeed.
> > But my question is, this copies *all* metadata.
> > What happens if the cond br had prof md?
> > They won't really make sense on uncond br.
> > Will verifier be ok with that, or should this specify which md to copy?
> Thanks for the hint. Looking at the pre-merge fails, the sanitizer check indeed complains about "Wrong number of operands". I did not think it was related, all the LLVM checks succeed. I could not find a common handling of metadata for branches such as `llvm::copyMetadataForLoad` for loads.
I'm guessing you are intentionally not copying `mustprocess`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101141/new/

https://reviews.llvm.org/D101141



More information about the llvm-commits mailing list