[LLVMdev] InstMetrics would look a lot like NoTTI

Andrew Trick atrick at apple.com
Wed Jan 30 11:07:31 PST 2013

I want to expose most of the logic in NoTTI to passes that do not depend on TTI for the purpose of pure IR-level instruction metrics. For example, we don't want the presence of certain "free" intrinsics to affect the patterns handled by canonical transforms. It would still be ok to use DataLayout here, so certain casts are considered free. The idea of "free" here has little to do with the cost to execute the operation and more to do with the fact that we don't want them to be barriers to optimization. The interface would also provide useful queries like isDuplicatable and isLoweredToCall.

Why do I care? This is holding up my work to improve LoopRotate, because I want to design heuristics independent of TTI. But more generally we want to better sandbox TTI (more on that in some later thread).

I'm hoping for quick feedback on the implementation of the next small step in this direction...

I could cleverly control the order of TTI passes so that -basictti doesn't run until after the non-TTI passes. But clever is bad. There should be a less subtle/confusing way.

I like the implementation currently in NoTTI and want to avoid scattering code. There are two easy possibilities:

1) I could create a NoTTI pass wrapper so that NoTTI can be used as a utility in addition to part of the analysis group:

struct NoTTIBase : TargetTransformInfo {
 ... all the TTI hooks ...

struct NoTTI : ImmutablePass, NoTTIBase {
  ... pass interface ...

Create a new Analysis/InstMetrics.(h|cpp) to expose only the queries that No-TTI passes are allowed to use. Instatiate a NoTTI instance on-the-fly

2) I could move the Target-Independent "cost" metrics into InstMetrics.cpp and use that interface within NoTTI.



More information about the llvm-dev mailing list