diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index 87666360c1a0..541dde6c47d2 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -1631,9 +1631,5 @@ Instruction *InstCombiner::visitFRem(BinaryOperator &I) { SQ.getWithInstruction(&I))) return replaceInstUsesWith(I, V); - // Handle cases involving: rem X, (select Cond, Y, Z) - if (simplifyDivRemOfSelectWithZeroOp(I)) - return &I; - return nullptr; } diff --git a/llvm/test/Transforms/InstCombine/rem.ll b/llvm/test/Transforms/InstCombine/rem.ll index 348190df5b10..f71a0fb4c621 100644 --- a/llvm/test/Transforms/InstCombine/rem.ll +++ b/llvm/test/Transforms/InstCombine/rem.ll @@ -594,11 +594,12 @@ define <2 x i32> @test23(<2 x i32> %A) { 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) { ; 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]] ; %sel = select i1 %cond, double %y, double 0.0