mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
[InstCombine] fix miscompile of frem with 0.0 operand (PR34870)
We might want to select NAN here or do this transform with fast-math, but this should at least fix the miscompile. llvm-svn: 321461
This commit is contained in:
parent
0c45856da6
commit
eb19224bbc
@ -1631,9 +1631,5 @@ Instruction *InstCombiner::visitFRem(BinaryOperator &I) {
|
|||||||
SQ.getWithInstruction(&I)))
|
SQ.getWithInstruction(&I)))
|
||||||
return replaceInstUsesWith(I, V);
|
return replaceInstUsesWith(I, V);
|
||||||
|
|
||||||
// Handle cases involving: rem X, (select Cond, Y, Z)
|
|
||||||
if (simplifyDivRemOfSelectWithZeroOp(I))
|
|
||||||
return &I;
|
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -594,11 +594,12 @@ define <2 x i32> @test23(<2 x i32> %A) {
|
|||||||
ret <2 x i32> %mul
|
ret <2 x i32> %mul
|
||||||
}
|
}
|
||||||
|
|
||||||
; FIXME: FP division-by-zero is not UB.
|
; FP division-by-zero is not UB.
|
||||||
|
|
||||||
define double @PR34870(i1 %cond, double %x, double %y) {
|
define double @PR34870(i1 %cond, double %x, double %y) {
|
||||||
; CHECK-LABEL: @PR34870(
|
; CHECK-LABEL: @PR34870(
|
||||||
; CHECK-NEXT: [[FMOD:%.*]] = frem double %x, %y
|
; CHECK-NEXT: [[SEL:%.*]] = select i1 %cond, double %y, double 0.000000e+00
|
||||||
|
; CHECK-NEXT: [[FMOD:%.*]] = frem double %x, [[SEL]]
|
||||||
; CHECK-NEXT: ret double [[FMOD]]
|
; CHECK-NEXT: ret double [[FMOD]]
|
||||||
;
|
;
|
||||||
%sel = select i1 %cond, double %y, double 0.0
|
%sel = select i1 %cond, double %y, double 0.0
|
||||||
|
Loading…
Reference in New Issue
Block a user