[PATCH] D101141: [SimplifyCFG] Preserve metadata when unconditionalizing branches.

Jeroen Dobbelaere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 23 00:27:08 PDT 2021


jeroen.dobbelaere added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:151
       // Replace the conditional branch with an unconditional one.
       Builder.CreateBr(Dest1);
       Value *Cond = BI->getCondition();
----------------
Shouldn't we also take care of the metadata here ?


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:166
+      SmallVector<std::pair<unsigned, MDNode *>, 4> BranchMetadata;
+      BI->getAllMetadata(BranchMetadata);
+
----------------
Can't we just copy the metadata from the `BI` directly ? Or will removing predecessors modify the attached metadata ?



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