<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - InstCombine leaves extra call to sqrtf from pow transform"
href="https://bugs.llvm.org/show_bug.cgi?id=47613">47613</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>InstCombine leaves extra call to sqrtf from pow transform
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Transformation Utilities
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>hstong@ca.ibm.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre>As noted in the review of D88066, there is an extra `sqrtf` call formed from
the call to `pow` in `shrink_pow_libcall_half` (below, extracted from
`llvm/test/Transforms/InstCombine/pow-4.ll`).
### SOURCE (<stdin>):
declare double @pow(double, double)
define float @shrink_pow_libcall_half(float %x) {
%dx = fpext float %x to double
%call = call fast double @pow(double %dx, double 0.5)
%fr = fptrunc double %call to float
ret float %fr
}
### LLVM INVOCATION:
opt -instcombine -S
### ACTUAL OUTPUT:
; ModuleID = '<stdin>'
source_filename = "<stdin>"
declare double @pow(double, double)
define float @shrink_pow_libcall_half(float %x) {
%sqrtf = call fast float @sqrtf(float %x)
%sqrtf1 = call fast float @sqrtf(float %x)
ret float %sqrtf1
}
declare float @powf(float, float)
declare double @sqrt(double)
declare float @sqrtf(float)
### EXPECTED OUTPUT:
(only one call to `sqrtf`)
### LLVM VERSION INFO (opt --version):
LLVM (<a href="http://llvm.org/">http://llvm.org/</a>):
LLVM version 12.0.0git
Optimized build.
Default target: x86_64-unknown-linux-gnu
Host CPU: sandybridge
### LLVM VERSION INFO:
<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
a8b8a9374a3c555ac8528fc37b92935554083b9f</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>