Open RKSimon opened 5 years ago
The failure here isn't caused by the constants. It's caused by calling fmod with double arguments on an sse1 only target. This fails too
define void @accum(double %x, double %y ) #0 { entry: %B6 = frem double %y, %x store double %B6, double* undef unreachable } attributes #0 = { "target-features"="+sse,-avx,-avx2,-sse2" }
We ended up with an xmm0 to fp0 COPY instruction which isn't supported. I feel like I've seen something like this before.
We've definitely seen variations of this before - see related bugs. But there were/are multiple problems visible in the original example:
The failure here isn't caused by the constants. It's caused by calling fmod with double arguments on an sse1 only target. This fails too
define void @accum(double %x, double %y ) #0 {
entry:
%B6 = frem double %y, %x
store double %B6, double* undef
unreachable
}
attributes #0 = { "target-features"="+sse,-avx,-avx2,-sse2" }
We ended up with an xmm0 to fp0 COPY instruction which isn't supported. I feel like I've seen something like this before.
SelectionDAG::foldConstantFPMath will handle FREM constant folding, but not if it will cause a APFloat::opDivByZero
Ah, the same restriction is on fdiv...and that seems wrong. If it's not a strict node, I think we should always fold it.
SelectionDAG::foldConstantFPMath will handle FREM constant folding, but not if it will cause a APFloat::opDivByZero
The underlying problem/workaround on this 1 appears to be that we don't have constant folding for an frem node in SDAG.
This gets folded in IR with -instsimplify for example.
Extended Description
Reduced from https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14508