[llvm-branch-commits] [llvm] [LoopInterchange] Drop loop metadata and branch weights of interchanged loops (PR #235892)
Ryotaro Kasuga via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Nov 22 07:22:21 PST 2026
================
@@ -2168,6 +2170,26 @@ void LoopInterchangeTransform::restructureLoops(
SE->forgetLoop(NewOuter);
}
+/// Update the metadata attached to the latch branches of the two loops. The
+/// loop metadata and the branch weights are dropped. Some attributes of the
+/// loop metadata may not hold after interchange (e.g.,
+/// llvm.loop.parallel_accesses of the inner loop doesn't imply that the loop is
+/// parallel when it becomes the outer loop), and no followup attributes are
+/// defined for interchange.
+/// TODO: Preserve the branch weights by swapping them.
----------------
kasuga-fj wrote:
Reworded the TODO. Since this patch still drops the weights (see my reply on L2187), I kept the TODO but removed "by swapping them".
https://github.com/llvm/llvm-project/pull/235892
More information about the llvm-branch-commits
mailing list