[PATCH] D12513: Update edge weights properly when merging blocks in if-conversion.

David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 13:52:56 PDT 2015


davidxl added a comment.

I'd like profile update to be isolated in its own helper function. Have some examples in the comments (like in the test case) -- the example should  show cfg before and after. The parameters also need to be documented.


================
Comment at: lib/CodeGen/IfConversion.cpp:1701
@@ +1700,3 @@
+        std::find(ToBBI.BB->succ_begin(), ToBBI.BB->succ_end(), FromBBI.BB), 0);
+    To2FromWeight = MBPI->getEdgeWeight(ToBBI.BB, FromBBI.BB);
+    SumWeight = MBPI->getSumForBlock(FromBBI.BB, WeightScale);
----------------
Should it be zero?

================
Comment at: lib/CodeGen/IfConversion.cpp:1736
@@ +1735,3 @@
+      // NewWeight.
+      if (ToBBI.BB->isSuccessor(Succ))
+        ToBBI.BB->setSuccWeight(
----------------
Do you have example of this case?


http://reviews.llvm.org/D12513





More information about the llvm-commits mailing list