Skip to content

Commit 3661877

Browse files
committed
minor fixes
1 parent 386e7c8 commit 3661877

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8036,6 +8036,7 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) {
80368036
return replaceOperand(I, 0, X);
80378037
if (Instruction *NV = FoldOpIntoSelect(I, cast<SelectInst>(LHSI)))
80388038
return NV;
8039+
break;
80398040
case Instruction::FSub:
80408041
switch (Pred) {
80418042
default:
@@ -8045,21 +8046,23 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) {
80458046
case FCmpInst::FCMP_UNE:
80468047
case FCmpInst::FCMP_OEQ:
80478048
case FCmpInst::FCMP_OGE:
8048-
case FCmpInst::FCMP_OLE: {
8049+
case FCmpInst::FCMP_OLE:
8050+
// fsub x, y --> isnnan(x, y) && isninf(x, y)
80498051
if (!LHSI->hasNoNaNs() && !LHSI->hasNoInfs() &&
80508052
!isKnownNeverInfinity(LHSI->getOperand(1), /*Depth=*/0,
80518053
getSimplifyQuery().getWithInstruction(&I)) &&
80528054
!isKnownNeverInfinity(LHSI->getOperand(0), /*Depth=*/0,
80538055
getSimplifyQuery().getWithInstruction(&I)))
80548056
break;
8055-
}
8056-
LLVM_FALLTHROUGH;
8057+
8058+
[[fallthrough]];
80578059
case FCmpInst::FCMP_OGT:
80588060
case FCmpInst::FCMP_OLT:
80598061
case FCmpInst::FCMP_ONE:
80608062
case FCmpInst::FCMP_UEQ:
80618063
case FCmpInst::FCMP_UGE:
80628064
case FCmpInst::FCMP_ULE:
8065+
// fcmp pred (x - y), 0 --> fcmp pred x, y
80638066
if (match(RHSC, m_AnyZeroFP()) &&
80648067
match(LHSI, m_FSub(m_Value(X), m_Value(Y))) &&
80658068
I.getFunction()->getDenormalMode(

llvm/test/Transforms/InstCombine/fcmp.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,7 +2055,7 @@ define <8 x i1> @fcmp_une_fsub_const_nnan_vec(<8 x float> %x, <8 x float> %y) {
20552055
ret <8 x i1> %cmp
20562056
}
20572057

2058-
define <8 x i1> @fcmp_ugt_fsub_const_vec_denormal_positive-zero(<8 x float> %x, <8 x float> %y) "denormal-fp-math"="positive-zero" {
2058+
define <8 x i1> @fcmp_ugt_fsub_const_vec_denormal_positive-zero(<8 x float> %x, <8 x float> %y) "denormal-fp-math"="positive-zero,positive-zero" {
20592059
; CHECK-LABEL: @fcmp_ugt_fsub_const_vec_denormal_positive-zero(
20602060
; CHECK-NEXT: [[FS:%.*]] = fsub <8 x float> [[X:%.*]], [[Y:%.*]]
20612061
; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt <8 x float> [[FS]], zeroinitializer
@@ -2077,7 +2077,7 @@ define <8 x i1> @fcmp_ogt_fsub_const_vec_denormal_dynamic(<8 x float> %x, <8 x f
20772077
ret <8 x i1> %cmp
20782078
}
20792079

2080-
define <8 x i1> @fcmp_ogt_fsub_const_vec_denormal_preserve-sign(<8 x float> %x, <8 x float> %y) "denormal-fp-math"="preserve-sign" {
2080+
define <8 x i1> @fcmp_ogt_fsub_const_vec_denormal_preserve-sign(<8 x float> %x, <8 x float> %y) "denormal-fp-math"="preserve-sign,preserve-sign" {
20812081
; CHECK-LABEL: @fcmp_ogt_fsub_const_vec_denormal_preserve-sign(
20822082
; CHECK-NEXT: [[FS:%.*]] = fsub <8 x float> [[X:%.*]], [[Y:%.*]]
20832083
; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt <8 x float> [[FS]], zeroinitializer

0 commit comments

Comments
 (0)