[PATCH] D20953: Remove typecast by using vector of loadinst/storeinst

Matthew Simpson via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 6 07:22:17 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL271895: [LAA] Use load and store vectors (NFC) (authored by mssimpso).

Changed prior to commit:
  http://reviews.llvm.org/D20953?vs=59523&id=59719#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20953

Files:
  llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp

Index: llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp
===================================================================
--- llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp
+++ llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp
@@ -1480,12 +1480,11 @@
 
 void LoopAccessInfo::analyzeLoop(const ValueToValueMap &Strides) {
 
-  typedef SmallVector<Value*, 16> ValueVector;
   typedef SmallPtrSet<Value*, 16> ValueSet;
 
-  // Holds the Load and Store *instructions*.
-  ValueVector Loads;
-  ValueVector Stores;
+  // Holds the Load and Store instructions.
+  SmallVector<LoadInst *, 16> Loads;
+  SmallVector<StoreInst *, 16> Stores;
 
   // Holds all the different accesses in the loop.
   unsigned NumReads = 0;
@@ -1580,10 +1579,8 @@
   // writes and between reads and writes, but not between reads and reads.
   ValueSet Seen;
 
-  ValueVector::iterator I, IE;
-  for (I = Stores.begin(), IE = Stores.end(); I != IE; ++I) {
-    StoreInst *ST = cast<StoreInst>(*I);
-    Value* Ptr = ST->getPointerOperand();
+  for (StoreInst *ST : Stores) {
+    Value *Ptr = ST->getPointerOperand();
     // Check for store to loop invariant address.
     StoreToLoopInvariantAddress |= isUniform(Ptr);
     // If we did *not* see this pointer before, insert it to  the read-write
@@ -1610,9 +1607,8 @@
     return;
   }
 
-  for (I = Loads.begin(), IE = Loads.end(); I != IE; ++I) {
-    LoadInst *LD = cast<LoadInst>(*I);
-    Value* Ptr = LD->getPointerOperand();
+  for (LoadInst *LD : Loads) {
+    Value *Ptr = LD->getPointerOperand();
     // If we did *not* see this pointer before, insert it to the
     // read list. If we *did* see it before, then it is already in
     // the read-write list. This allows us to vectorize expressions


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20953.59719.patch
Type: text/x-patch
Size: 1731 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160606/ae2cbdad/attachment.bin>


More information about the llvm-commits mailing list