[PATCH] D49273: [InstCombine] Expand the simplification of pow() into exp2()

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 15 23:09:31 PDT 2018


uabelho added a comment.

Hi,
A late comment about a problem I've noticed with this change.



================
Comment at: llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp:1276
+      else
+        return emitUnaryFloatFnCall(FMul, TLI->getName(LibFunc_exp2), B, Attrs);
+    }
----------------
On my target, exp2f is available, but exp2 isn't, so the

 hasUnaryFloatFn(TLI, Ty, LibFunc_exp2, LibFunc_exp2f, LibFunc_exp2l)

guard above returns true, but then when we try to find the name of LibFunc_exp2 we get "".

emitUnaryFloatFnCall doesn't check that the input name is something nice, it just happily adds an "f" to the name, and we end up with code trying to call the function "f" which eventually leads to a linking error.

Any thoughts about such cases?


Repository:
  rL LLVM

https://reviews.llvm.org/D49273





More information about the llvm-commits mailing list