Expand the simplification of special cases of log() to include log2() and log10() as well as intrinsics and more types.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Patch uploaded without context.
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | ||
---|---|---|
1710 ↗ | (On Diff #218803) | Does this do the right thing for non-double libcalls? |
2888 ↗ | (On Diff #218803) | not Intrinsic::log10? |
llvm/test/Transforms/InstCombine/log-pow.ll | ||
93 ↗ | (On Diff #218803) | I'm not sure why you want to remove test coverage for log10f? |
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | ||
---|---|---|
2888 ↗ | (On Diff #218803) | No, but perhaps I am. |
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | ||
---|---|---|
1807 ↗ | (On Diff #218815) | Can you extract this code and comment to helper function? Can be used also a few lines below. |
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | ||
---|---|---|
1807 ↗ | (On Diff #218815) | Can do, using the existing LibCallSimplifier::replaceAllUsesWith() for this purpose. |
Please also clang format the parts you modified, otherwise this looks ok.
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | ||
---|---|---|
1807 ↗ | (On Diff #218815) | Thanks |
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | ||
---|---|---|
1788 ↗ | (On Diff #219424) | Just using the same scheme as for the Log CallInst... |
This patch is blamed for a compiler crash in PR43617:
https://bugs.llvm.org/show_bug.cgi?id=43617
llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp | ||
---|---|---|
1923 | This should be using the overload of getLibFunc that takes a CallSite, instead of expanding it out by hand. This formulation skips checks that should happen otherwise (specifically, that it's not an indirect call, that the call isn't marked nobuiltin, and the function has an appropriate signature). |
llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp | ||
---|---|---|
1923 | True, but, as @craig.topper said, the cast at line 1919 above might be returning nullptr. |
llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp | ||
---|---|---|
1923 | The CallSite version specifically checks that getCalledFunction doesn't return null. Because the case where it returns null is for an indirect call. |
This should be using the overload of getLibFunc that takes a CallSite, instead of expanding it out by hand. This formulation skips checks that should happen otherwise (specifically, that it's not an indirect call, that the call isn't marked nobuiltin, and the function has an appropriate signature).