[llvm] r182100 - LoopVectorize: Simplify code. No functionality change.

Benjamin Kramer benny.kra at googlemail.com
Fri May 17 07:48:17 PDT 2013


Author: d0k
Date: Fri May 17 09:48:17 2013
New Revision: 182100

URL: http://llvm.org/viewvc/llvm-project?rev=182100&view=rev
Log:
LoopVectorize: Simplify code. No functionality change.

Modified:
    llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp

Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=182100&r1=182099&r2=182100&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Fri May 17 09:48:17 2013
@@ -354,24 +354,10 @@ bool LoadHoisting::isHoistableLoad(Instr
 
 static void addMemAccesses(BasicBlock *BB, SmallPtrSet<Value *, 8> &Set) {
   for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE; ++BI) {
-    Instruction *I = &*BI;
-    Value *Addr = 0;
-
-    // Try a load.
-    LoadInst *LI = dyn_cast<LoadInst>(I);
-    if (LI) {
-      Addr = LI->getPointerOperand();
-      Set.insert(Addr);
-      continue;
-    }
-
-    // Try a store.
-    StoreInst *SI = dyn_cast<StoreInst>(I);
-    if (!SI)
-      continue;
-
-    Addr = SI->getPointerOperand();
-    Set.insert(Addr);
+    if (LoadInst *LI = dyn_cast<LoadInst>(BI)) // Try a load.
+      Set.insert(LI->getPointerOperand());
+    else if (StoreInst *SI = dyn_cast<StoreInst>(BI)) // Try a store.
+      Set.insert(SI->getPointerOperand());
   }
 }
 
@@ -2708,9 +2694,7 @@ void LoopVectorizationLegality::collectL
     Uniforms.insert(I);
 
     // Insert all operands.
-    for (int i = 0, Op = I->getNumOperands(); i < Op; ++i) {
-      Worklist.push_back(I->getOperand(i));
-    }
+    Worklist.insert(Worklist.end(), I->op_begin(), I->op_end());
   }
 }
 





More information about the llvm-commits mailing list