<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hi Paul, </div><div><br></div><div>Thanks for working on this.  Can you also refactor the code that sets metadata on vectorized loops (so that they are not re-vectorized) ?</div><div><br></div><div> </div><div><div>-bool Loop::isAnnotatedParallel() const {</div><div>+MDNode *Loop::getLoopID() const {</div><div>+  MDNode *LoopID = 0;</div><div><br></div><div>Please add braces below. </div><div><br></div><div>+  if (isLoopSimplifyForm())</div><div>+    LoopID = getLoopLatch()->getTerminator()->getMetadata("llvm.loop");</div><div>+  else {</div><div>+    // Go through each predecessor of the loop header and check the</div><div>+    // terminator for the metadata.</div><div>+    BasicBlock *H</div><div><br></div><div><br></div><div>Please add a string for the asserts below.</div><div><br></div><div>+void Loop::setLoopID(MDNode *LoopID) const {</div><div>+  assert(LoopID);</div><div>+  assert(LoopID->getNumOperands() > 0);</div><div>+  assert(LoopID->getOperand(0) == LoopID);</div><div><br></div><div><br></div><div>Can you outline the code below to a function and use it around the code that checks for the command line flags ?</div><div> </div><div>+    unsigned UserVF = VectorizationFactor;</div><div>+</div><div>+    // Check the loop metadata for vectorization hints.</div><div>+    if (const MDNode *LoopID = L->getLoopID()) {</div><div>+      assert(LoopID->getNumOperands() > 0);</div><div>+      assert(LoopID->getOperand(0) == LoopID);</div><div>+      for (unsigned i = 1, ie = LoopID->getNumOperands(); i < ie; ++i) {</div><div>+        const MDNode *MD = dyn_cast<MDNode>(LoopID->getOperand(i));</div><div>+        if (!MD)</div><div>+          continue;</div><div><br></div><div>Use early exits (continue) here: </div><div><br></div><div>+        if (MD->getNumOperands() == 2) {</div><div>+          if (const MDString *S = dyn_cast<MDString>(MD->getOperand(0))) {</div><div>+            if (S->getString() == "llvm.vectorization.vector_width") {</div><div>+              const ConstantInt *C = dyn_cast<ConstantInt>(MD->getOperand(1));</div><div>+              UserVF = C ? C->getZExtValue() : UserVF;</div><div><br></div><div><br></div><div>Because of this:</div><div><br></div><div>+            }</div><div>+          }</div><div>+        }</div><div>+      }</div><div>+    }</div><div>+</div><div>    </div><div><br></div><div>Thanks,</div><div>Nadav</div><div><br></div></div><br><div><div>On May 24, 2013, at 10:49 AM, "Redmond, Paul" <<a href="mailto:paul.redmond@intel.com">paul.redmond@intel.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Hi,<br><br>The attached patch modifies LoopVectorizer to recognize llvm.vectorization.vector_width metadata attached to llvm.loop metadata.<br><br>The llvm.loop.parallel metadata has been renamed to llvm.loop to be more generic. Loop::isAnnotatedParallel now looks for llvm.loop and associated llvm.mem.parallel_loop_access. If we decide that we still need an explicit llvm.loop.parallel metadata then it can be added as a child of llvm.loop.<br><br>Loop::setLoopID was added for symmetry and it is used in a forthcoming patch which preserves llvm.loop metadata in loop passes.<br><br>paul<br><br><span><Mail Attachment></span>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></div></blockquote></div><br></body></html>