[SLC] Allow llvm.pow(x,2.0) -> x*x etc even if no pow() lib func
authorJay Foad <jay.foad@amd.com>
Thu, 30 Apr 2020 15:53:20 +0000 (16:53 +0100)
committerJay Foad <jay.foad@amd.com>
Mon, 4 May 2020 09:54:07 +0000 (10:54 +0100)
commite737847b8fc36b6526ad6c7ceb65d0bd07358497
tree73fe92e96b08d34cff2c78dcfbdb7c24c69bbab9
parent8e9a8dc185be14246172ffc9b6b8c61a9d8d7cc4
[SLC] Allow llvm.pow(x,2.0) -> x*x etc even if no pow() lib func

optimizePow does not create any new calls to pow, so it should work
regardless of whether the pow library function is available. This allows
it to optimize the llvm.pow intrinsic on targets with no math library.

Based on a patch by Tim Renouf.

Differential Revision: https://reviews.llvm.org/D68231
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/test/Transforms/InstCombine/pow-1.ll
llvm/test/Transforms/InstCombine/pow-3.ll