https://bugs.llvm.org/show_bug.cgi?id=47943
Bug ID: 47943
Summary: Incorrect fabs optimization when fdiv or fmul is
involved
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: juneyoung....@sf.snu.ac.kr
CC: llvm-bugs@lists.llvm.org
----------------------------------------
// Transforms/InstCombine/fmul.ll
define float @fabs_squared(float %x) {
%0:
%x.fabs = fabs float %x
%mul = fmul float %x.fabs, %x.fabs
ret float %mul
}
=>
define float @fabs_squared(float %x) {
%0:
%mul = fmul float %x, %x
ret float %mul
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
float %x = undef
Source:
float %x.fabs = NaN [based on undef value]
float %mul = NaN [based on undef value]
Target:
float %mul = #x80000000 (-0.0)
Source value: NaN
Target value: #x80000000 (-0.0)
----------------------------------------
// Transforms/InstCombine/fdiv.ll
define float @fabs_same_op(float %x) {
%0:
%a = fabs float %x
%r = fdiv float %a, %a
ret float %r
}
=>
define float @fabs_same_op(float %x) {
%0:
%r = fdiv float %x, %x
ret float %r
}
Transformation doesn't verify!
ERROR: Value mismatch
----------------------------------------
After optimization, `fmul %x, %x` isn't guaranteed to be non-negative because
the result can be negative if %x was undef.
Similarly for the `fdiv` case.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs