[PATCH] D14617: alignment info for cost estimation in SLP vectorization

Tong Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 07:37:45 PST 2015


chentong updated this revision to Diff 41047.
chentong added a comment.

1. yes, the alignment for vector type is changed
2. clang-format is used


http://reviews.llvm.org/D14617

Files:
  lib/Transforms/Vectorize/SLPVectorizer.cpp

Index: lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -1616,16 +1616,22 @@
     }
     case Instruction::Load: {
       // Cost of wide load - cost of scalar loads.
+      LoadInst *LoadI = cast<LoadInst>(VL[0]);
       int ScalarLdCost = VecTy->getNumElements() *
-      TTI->getMemoryOpCost(Instruction::Load, ScalarTy, 1, 0);
-      int VecLdCost = TTI->getMemoryOpCost(Instruction::Load, VecTy, 1, 0);
+                         TTI->getMemoryOpCost(Instruction::Load, ScalarTy,
+                                              LoadI->getAlignment(), 0);
+      int VecLdCost = TTI->getMemoryOpCost(Instruction::Load, VecTy,
+                                           LoadI->getAlignment(), 0);
       return VecLdCost - ScalarLdCost;
     }
     case Instruction::Store: {
       // We know that we can merge the stores. Calculate the cost.
+      StoreInst *StoreI = cast<StoreInst>(VL[0]);
       int ScalarStCost = VecTy->getNumElements() *
-      TTI->getMemoryOpCost(Instruction::Store, ScalarTy, 1, 0);
-      int VecStCost = TTI->getMemoryOpCost(Instruction::Store, VecTy, 1, 0);
+                         TTI->getMemoryOpCost(Instruction::Store, ScalarTy,
+                                              StoreI->getAlignment(), 0);
+      int VecStCost = TTI->getMemoryOpCost(Instruction::Store, VecTy,
+                                           StoreI->getAlignment(), 0);
       return VecStCost - ScalarStCost;
     }
     case Instruction::Call: {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14617.41047.patch
Type: text/x-patch
Size: 1624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151124/6f39d2aa/attachment.bin>


More information about the llvm-commits mailing list