[PATCH] D129468: [NFC] Fix compile time regression seen on some benchmarks after a630ea3003 commit

Dawid Jurczak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 05:45:20 PDT 2022


yurai007 added inline comments.


================
Comment at: llvm/include/llvm/IR/Metadata.h:1043
+        return SmallNumOps;
+      return operands().size();
+    }
----------------
nikic wrote:
> Directly use `getLarge().size()` here?
Right, it should be slightly better. There is no need to check IsLarge twice in slow path.


================
Comment at: llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp:306
     bool NewFormat = isNewFormat();
+    const ArrayRef<MDOperand> Operands(Node->op_begin(), Node->op_end());
+    const unsigned NumOperands = Operands.size();
----------------
nikic wrote:
> Can use `Node->operands()` here?
Unfortunately not. I tried this initially, but there is no simple conversion from iterator_range<const llvm::MDOperand *> to MutableArrayRef/ArrayRef<llvm::MDOperand>. Also making Operands iterator_range complicates things with indexing and getting size so ended up with passing iterators directly to ArrayRef.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129468/new/

https://reviews.llvm.org/D129468



More information about the llvm-commits mailing list