[llvm-commits] [llvm] r93448 - /llvm/trunk/lib/Analysis/InlineCost.cpp

Chris Lattner clattner at apple.com
Thu Jan 14 12:54:17 PST 2010


On Jan 14, 2010, at 12:12 PM, Eric Christopher wrote:

> +// callIsSmall - If a call will lower to a single selection DAG  
> node, or
> +// is otherwise deemed small return true.

"is likely to lower to a single target instruction"

> +// TODO: Perhaps calls like memcpy, strcpy, etc?
> +static bool callIsSmall(const Function *F) {
> +  if (F && !F->hasLocalLinkage() && F->hasName()) {
> +    StringRef Name = F->getName();
> +

Please use early return to avoid nesting this.

+    // These are all likely to be optimized into something smaller.
+    if (Name == "pow" || Name == "powf" || Name == "powl" ||
+        Name == "exp2" || Name == "exp2l" || Name == "exp2f" ||
+        Name == "floor" || Name == "floorf" || Name == "ceil" ||
+        Name == "round" || Name == "ffs" || Name == "ffsl" ||
+        Name == "abs" || Name == "labs" || Name == "llabs")

exp* and pow* usually don't get inlined, do they?

-Chris



More information about the llvm-commits mailing list