[llvm-commits] [PATCH] Population-count loop idiom recognization

Dmitri Gribenko gribozavr at gmail.com
Mon Nov 19 13:28:39 PST 2012


Hi Shuxin,

Just mechanical issues (I'm not familiar with this part of LLVM):

+  /// CreateCtpop - Create and insert ctpop.
+  CallInst *CreateCtpop(Value *Val);

Please don't duplicate function or class name inside the comment.  Old
code is written that way, but current coding style advises not to
duplicate.

+  assert(!(TyWidth & (TyWidth - 1)) && "Ty width must be power of 2");

Please call isPowerOf2_32 from llvm/Support/MathExtras.h.

+CallInst *IRBuilderBase::
+CreateCtpop(Value *Val) {

No newline after '::' needed.

+  class LIRUtil {
+  public:

This class has no data members, and all member functions are static.
It makes sense to just put these functions in the anonymous namespace.

+    static BranchInst *getBranch(BasicBlock * BB) {

No space before '*', please.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the llvm-commits mailing list