[PATCH] D29017: refactor / improve getScalarizationOverhead()

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 16:49:06 PST 2017


hfinkel accepted this revision.
hfinkel added a comment.
This revision is now accepted and ready to land.

Please remove the assert and add a comment as noted below. Otherwise, LGTM.



================
Comment at: include/llvm/CodeGen/BasicTTIImpl.h:307
+                                            unsigned VF) {
+    assert (!Args.empty() && "Should only be called with existing arguments");
+    unsigned Cost = 0;
----------------
I don't see the point in asserting here. If there are no arguments, then there's no cost, so you'll just return zero. That seems useful to avoid unnecessary special cases in potential callers.


================
Comment at: include/llvm/CodeGen/BasicTTIImpl.h:366
+      else
+        TotCost += getScalarizationOverhead(Ty, false, true);
+      return TotCost;
----------------
Please add a comment here that, when no information on arguments is provided, as a heuristic, we add the cost associated with one argument.


https://reviews.llvm.org/D29017





More information about the llvm-commits mailing list