[PATCH] D63844: [LoopFusion] Extend use of OptimizationRemarkEmitter

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 14:37:47 PDT 2019


jdoerfert added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopFuse.cpp:1173
+             << Stat.getDesc());
+  }
 };
----------------
kbarton wrote:
> jdoerfert wrote:
> > I would somehow prefer if the two functions above were merged or at least one uses the other. The ORE part is almost identical and we could, probably should, increment the relevant statistic in `reportLoopFusion` as well.
> I agree passing the stat into reportLoopFusion makes sense. I'll make that change.
> 
> I don't quite understand the point about commoning these two functions into a single function though. They fundamentally do two different things: for successful fusion we emit to OptimizationRemark; for unsuccessful fusion we emit to OptimizationRemarkMissed.
> 
> So, in order to common these up there needs to be a check to figure out which OptimizationRemark class to use. At that point, the only commonality that you get is the increment of Stat. 
> 
> Am I missing something?
> 
> They fundamentally do two different things:

I think they do the same, remark emission and bookkeeping.


> So, in order to common these up there needs to be a check to figure out which OptimizationRemark class to use. At that point, the only commonality that you get is the increment of Stat.

We know at the call site, right?


```
template<typename RemarkKind> reportFusion(...) {
 ...
 ORE.emit(RemarkKind(DEBUG_TYPE, Stat.getName(), FC0.L->getStartLoc(), FC0.Preheader)
  << ...
}


reportFusion<OptimizationRemark>(....);

reportFusion<OptimizationRemarkMissed>(....);

```




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63844





More information about the llvm-commits mailing list