File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
lib/Transforms/InstCombine
test/Transforms/InstCombine Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -3929,7 +3929,10 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
39293929
39303930 // Canonicalize select of FP values where NaN and -0.0 are not valid as
39313931 // minnum/maxnum intrinsics.
3932- if (SIFPOp->hasNoNaNs () && SIFPOp->hasNoSignedZeros ()) {
3932+ if (SIFPOp->hasNoNaNs () &&
3933+ (SIFPOp->hasNoSignedZeros () ||
3934+ (SIFPOp->hasOneUse () &&
3935+ canIgnoreSignBitOfZero (*SIFPOp->use_begin ())))) {
39333936 Value *X, *Y;
39343937 if (match (&SI, m_OrdOrUnordFMax (m_Value (X), m_Value (Y)))) {
39353938 Value *BinIntr =
Original file line number Diff line number Diff line change @@ -174,8 +174,7 @@ define i8 @t11(float %a, float %b) {
174174; Either operand could be NaN, but nnan modifier applied.
175175define i8 @t12 (float %a , float %b ) {
176176; CHECK-LABEL: @t12(
177- ; CHECK-NEXT: [[DOTINV:%.*]] = fcmp nnan oge float [[B:%.*]], [[A:%.*]]
178- ; CHECK-NEXT: [[DOTV:%.*]] = select nnan i1 [[DOTINV]], float [[A]], float [[B]]
177+ ; CHECK-NEXT: [[DOTV:%.*]] = call nnan float @llvm.minnum.f32(float [[B:%.*]], float [[A:%.*]])
179178; CHECK-NEXT: [[TMP1:%.*]] = fptosi float [[DOTV]] to i8
180179; CHECK-NEXT: ret i8 [[TMP1]]
181180;
You can’t perform that action at this time.
0 commit comments