[PATCH] D76664: [ConstantFold][NFC] Compile time optimization for large vectors

Thomas Raoux via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 15:41:31 PDT 2020


ThomasRaoux marked an inline comment as done.
ThomasRaoux added inline comments.


================
Comment at: llvm/include/llvm/IR/Constants.h:770
+      : ConstantDataSequential(ty, ConstantDataVectorVal, Data),
+        IsSplat(isSplatData(ty, Data)) {}
+  const bool IsSplat;
----------------
kariddi wrote:
> This introduces a linear scan in the creation of the ConstantDataVector() class, I wonder if this might be wasteful if "isSplat()" never endsup to be called on a particular vector.
> 
> I wonder if moving this scan in "isSplat()" and caching the result might be better (as isSplat() already was an expensive method, while the construction of ConstantDataVector was not)
Here is an alternative solution were we lazily set IsSplat. I assume it is going to be rare that we create a constant and not have any pass call isSplat on it but it could make sense to try to keep creation cheap. What do you think of this solution?


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

https://reviews.llvm.org/D76664





More information about the llvm-commits mailing list