[PATCH] [PPC64LE] Remove unnecessary swaps from lane-insensitive vector computations

Eric Christopher echristo at gmail.com
Mon Mar 30 14:17:10 PDT 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/Target/PowerPC/PPCVSXSwapRemoval.cpp:204
@@ +203,3 @@
+
+  const int InitialVectorSize(256);
+  SwapVector.clear();
----------------
wschmidt wrote:
> echristo wrote:
> > wschmidt wrote:
> > > echristo wrote:
> > > > 256?
> > > Hey, a magic constant.  That's why I gave it a name. :)  Picking an initial vector size to avoid too many reallocations while keeping the size reasonable.  Yes, it's a wet thumb to the breeze...
> > Did you use science to figure it out (i.e. see what numbers would generally work etc) or just WAG?
> Semi-science, yes.  I've spent some time on this in GCC as well and gotten a pretty good feel for what happens.  256 is sufficiently large to prevent any reallocations in the usual case.  For larger functions, we will see a reallocation or two.  My testing on LLVM indicated that the code in projects/test-suite used no reallocations except for three of the benchmarks (I know this because my implementation was broken, so I noticed failures when the reallocations occurred).  So I feel this is a good choice.
Good enough science for me. I was hoping you'd collected normal size, but this is probably close enough.

http://reviews.llvm.org/D8565

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list