[PATCH] D138333: [CHR] Add a threshold for the code duplication

Rong Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 14:12:06 PST 2022


xur added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp:358
+                            IRBuilder<> &IRB, Value *&MergedCondition);
+  unsigned getRegionDuplicationCount(const Region *R) {
+    unsigned Count = 0;
----------------
davidxl wrote:
> add comment
ack


================
Comment at: llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp:389
   DenseSet<CHRScope *> Scopes;
+  DenseMap<const Region *, unsigned> DuplicationCount;
 };
----------------
davidxl wrote:
> add comment to the member.
ack


================
Comment at: llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp:1681
+
+  for (RegInfo &RI : Scope->RegInfos) {
+    const Region *R = RI.R;
----------------
davidxl wrote:
>  is there a need to track all regions in the scope? They seem to have the same dup factor ?
The regions in the scope do have the same dup factor. The reason we need a dup factor for each region is that we will accumulate the dup factor for the nested regions (in new function of getRegionDuplicationCount). In addition, most of the scopes has a single region. 


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

https://reviews.llvm.org/D138333



More information about the llvm-commits mailing list