[PATCH] D22630: Loop rotation

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 12 12:20:59 PDT 2016


mzolotukhin added a comment.

> I have updated the loop rotation to add a metadata if the loop rotation was successful, such that it does not rotate the loop multiple times.

Can we do it without metadata? Why can't we tell if a loop need to be rotated just by examining it (and after it is rotated, subsequent examination should tell that no rotation is need, so subsequent invocations of LoopRotate would have no effect)?



================
Comment at: llvm/include/llvm/Analysis/LoopInfo.h:444
   /// 0 is returned.
-  MDNode *getLoopID() const;
+  std::pair<MDNode *, Instruction *> getLoopIDWithInstr() const;
+  MDNode *getLoopID() const { return getLoopIDWithInstr().first; }
----------------
This needs to be documented.


================
Comment at: llvm/lib/Analysis/LoopInfo.cpp:225
           LoopID = MD;
+          I = TI;
+        }
----------------
What if a loop has two backedges? `LoopID` would be the same for both of them, but `TI` obviously would be different.


================
Comment at: llvm/lib/IR/LLVMContextImpl.h:996
   void getAll(SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const;
+  void getAllIDs(SmallVectorImpl<unsigned> &Result) const;
 
----------------
A comment would be helpful here.


https://reviews.llvm.org/D22630





More information about the llvm-commits mailing list