[PATCH] D39980: Add heuristics for irreducible loop metadata under PGO

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 09:42:43 PST 2017


davidxl added inline comments.


================
Comment at: include/llvm/Analysis/BlockFrequencyInfoImpl.h:1170
+              << getBlockName(HeaderNode) << "\n");
+        HeadersWithoutWeight.insert(H);
         continue;
----------------
what is the root cause of missing header weight?


================
Comment at: include/llvm/Analysis/BlockFrequencyInfoImpl.h:1184
     }
+    // As a heuristic, if some headers don't have a weight, give them the
+    // minimium weight seen. If no headers have a weight, give them even weight
----------------
What is the intuition behind this heuristic?


================
Comment at: include/llvm/Analysis/BlockFrequencyInfoImpl.h:1196
+            << " to " << getBlockName(HeaderNode) << "\n");
+      if (MinHeaderWeight && MinHeaderWeight.getValue())
+        Dist.addLocal(HeaderNode, MinHeaderWeight.getValue());
----------------
Is this check needed? MinHeaderWeight is always set.


================
Comment at: test/Analysis/BlockFrequencyInfo/irreducible_pgo.ll:83
   %0 = load i32, i32* @tracing, align 4
+  %1 = trunc i32 %0 to i8
   %tobool = icmp eq i32 %0, 0
----------------
The test simplification change can be committed as a separate patch.


================
Comment at: test/Transforms/PGOProfile/irreducible.ll:72
   %0 = load i32, i32* @tracing, align 4
+  %1 = trunc i32 %0 to i8
   %tobool = icmp eq i32 %0, 0
----------------
Split out the test simplification change into another patch.


https://reviews.llvm.org/D39980





More information about the llvm-commits mailing list