[SLP] Emit optimization remarks
authorAdam Nemet <anemet@apple.com>
Thu, 11 May 2017 17:06:17 +0000 (17:06 +0000)
committerAdam Nemet <anemet@apple.com>
Thu, 11 May 2017 17:06:17 +0000 (17:06 +0000)
commit0aca09fc6cdcda65a44dc084b20d7056912977ef
tree4548aede161f91b821d09c58dad38f79bbc67db0
parent96c3d626a277202498349675e1cce2e1f8a8b072
[SLP] Emit optimization remarks

The approach I followed was to emit the remark after getTreeCost concludes
that SLP is profitable.  I initially tried emitting them after the
vectorizeRootInstruction calls in vectorizeChainsInBlock but I vaguely
remember missing a few cases for example in HorizontalReduction::tryToReduce.

ORE is placed in BoUpSLP so that it's available from everywhere (notably
HorizontalReduction::tryToReduce).

We use the first instruction in the root bundle as the locator for the remark.
In order to get a sense how far the tree is spanning I've include the size of
the tree in the remark.  This is not perfect of course but it gives you at
least a rough idea about the tree.  Then you can follow up with -view-slp-tree
to really see the actual tree.

llvm-svn: 302811
llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/AArch64/getelementptr.ll
llvm/test/Transforms/SLPVectorizer/AArch64/horizontal.ll
llvm/test/Transforms/SLPVectorizer/AArch64/remarks.ll [new file with mode: 0644]