[PATCH] D46637: [TTI] Add uniform/non-uniform constant Pow2 detection to TargetTransformInfo::getInstructionThroughput

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 08:47:06 PDT 2018


ABataev added inline comments.


================
Comment at: lib/Analysis/TargetTransformInfo.cpp:760-772
+      if (auto *CI = dyn_cast<ConstantInt>(Splat))
+        if (CI->getValue().isPowerOf2())
+          OpProps = TargetTransformInfo::OP_PowerOf2;
+    } else if (auto *CDS = dyn_cast<ConstantDataSequential>(V)) {
+      OpProps = TargetTransformInfo::OP_PowerOf2;
+      for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
+        if (auto *CI = dyn_cast<ConstantInt>(CDS->getElementAsConstant(i)))
----------------
RKSimon wrote:
> ABataev wrote:
> > This analysis should be guarded by the check of the `OVP` parameter if it is `nullptr` or not.
> I tried that but it got rather messy. An alternative would be to make OVP a reference instead of a pointer, since its always used - what do you think?
Yes, I think it would be much better


Repository:
  rL LLVM

https://reviews.llvm.org/D46637





More information about the llvm-commits mailing list