[PATCH] Global Structure Vectorization

Arnold Schwaighofer aschwaighofer at apple.com
Thu Feb 21 09:21:05 PST 2013


LGTM with a few style nitpicks:


+      // Never seen it before, can't alias.
+      if (WriteObjects[*UI].size() == 0) {

+      if (WriteObjects[*UI].size() == 0)
+        continue;
WriteObjects[*UI].empty()


+  /// Return true if there is the chance of write reorder.
+  bool hasPossibleGlobalWriteReorder(Value *Object,
+                                     Instruction *Inst,
+                                     AliasMultiMap& WriteObjects,
AliasMultiMap &WriteObjects

+AliasAnalysis::Location
+LoopVectorizationLegality::getLoadStoreLocation(Instruction *Inst) {
+  if (StoreInst* Store = dyn_cast<StoreInst>(Inst))
+    return AA->getLocation(Store);
+  else if (LoadInst* Load = dyn_cast<LoadInst>(Inst))
StoreInst *Store
LoadInst *Load

+  std::vector<Instruction*>::iterator
+              it=WriteObjects[Object].begin(),
+              end=WriteObjects[Object].end();

Space before and after "="
+  for (MI = ReadWrites.begin(), ME = ReadWrites.end(); MI != ME; ++MI) {
+    Value* V = (*MI).first;
Value *V

+  for (MI = Reads.begin(), ME = Reads.end(); MI != ME; ++MI) {
+    Value* V = (*MI).first;
Value *V

+  for (MI = ReadWrites.begin(), ME = ReadWrites.end(); MI != ME; ++MI) {
+    Value *Val = (*MI).first;
+    Instruction* Inst = (*MI).second;
Instruction *Inst

2x:
+      // If global alias, make sure they do alias.
+      if (hasPossibleGlobalWriteReorder(*UI,
+                                        Inst,
+                                        WriteObjects,
+                                        MaxByteWidth)) {

Can we use the full 80 col here?


Thanks,
Arnold


On Feb 21, 2013, at 2:37 AM, Renato Golin <renato.golin at linaro.org> wrote:

> The "Seen.insert()" was redundant, since it's now a map.
> 
> cheers,
> --renato
> 
> 
> On 21 February 2013 00:58, Renato Golin <renato.golin at linaro.org> wrote:
> Sorry, I forgot the C-code in the test, now added...
> 
> --renato
> 
> 
> On 21 February 2013 00:53, Renato Golin <renato.golin at linaro.org> wrote:
> Ok, refactored the patch. No intended change, no regression on check-all or LNT.
> 
> 1. Full stops on comments
> 2. Exported hasPossibleGlobalWriteReorder() and getLoadStoreLocation()
> 3. Using DenseMap
> 4. Merged all tests into one (global_alias.ll)
> 
> 
> cheers,
> --renato
> 
> 
> <global_vectorize-6.patch>




More information about the llvm-commits mailing list