-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
Description
| Bugzilla Link | 47943 |
| Version | trunk |
| OS | All |
| Blocks | #47292 |
| CC | @LebedevRI,@RKSimon,@nikic,@nunoplopes,@regehr,@rotateright |
Extended Description
// 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.