[PATCH] D33404: [PowerPC] Fix a performance bug for PPC::XXPERMDI.

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 27 12:23:10 PDT 2017


hfinkel added inline comments.


================
Comment at: lib/Target/PowerPC/PPCISelLowering.cpp:1606
+  unsigned NumOfElem = 16 / Width;
+  unsigned *MaskVal = new unsigned[Width];
+  for (unsigned i = 0; i < NumOfElem; ++i) {
----------------
nemanjai wrote:
> Is there a compelling reason to manually allocate memory for this over using efficient containers (something like `SmallVector` or similar)?
> 
> I'd much rather avoid manual memory management of this sort if we can. And I don't see anything in this function to indicate we can't.
We should definitely be using a SmallVector here, if we need to keep track of the size easily. Otherwise, given that Width is never greater than 16, we can just use:
  unsigned MaskVal[16];



https://reviews.llvm.org/D33404





More information about the llvm-commits mailing list