summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-02-20 00:20:38 +0000
committerSanjay Patel <spatel@rotateright.com>2019-02-20 00:20:38 +0000
commit49f97395abb4c05dd10741ef5552fcbfd7f15ec2 (patch)
tree04554dbd6878778b40a32532acbe8b6178fd22e2 /llvm/lib
parenta259dc3263054eda5a77dd61d3cb0f4965b8d05a (diff)
downloadbcm5719-llvm-49f97395abb4c05dd10741ef5552fcbfd7f15ec2.tar.gz
bcm5719-llvm-49f97395abb4c05dd10741ef5552fcbfd7f15ec2.zip
Revert "[InstSimplify] use any-zero matcher for fcmp folds"
This reverts commit 058bb8351351d56d2a4e8a772570231f9e5305e5. Forgot to update another test affected by this change. llvm-svn: 354408
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp47
1 files changed, 22 insertions, 25 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 092aaf610ca..843b3e97c07 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -3648,31 +3648,6 @@ static Value *SimplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
}
// Handle fcmp with constant RHS.
- if (match(RHS, m_AnyZeroFP())) {
- switch (Pred) {
- case FCmpInst::FCMP_OGE:
- if (FMF.noNaNs() && CannotBeOrderedLessThanZero(LHS, Q.TLI))
- return getTrue(RetTy);
- break;
- case FCmpInst::FCMP_UGE:
- if (CannotBeOrderedLessThanZero(LHS, Q.TLI))
- return getTrue(RetTy);
- break;
- case FCmpInst::FCMP_ULT:
- if (FMF.noNaNs() && CannotBeOrderedLessThanZero(LHS, Q.TLI))
- return getFalse(RetTy);
- break;
- case FCmpInst::FCMP_OLT:
- if (CannotBeOrderedLessThanZero(LHS, Q.TLI))
- return getFalse(RetTy);
- break;
- default:
- break;
- }
- }
-
- // TODO: Use match with a specific FP value, so these work with vectors with
- // undef lanes.
const APFloat *C;
if (match(RHS, m_APFloat(C))) {
// Check whether the constant is an infinity.
@@ -3700,6 +3675,28 @@ static Value *SimplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
break;
}
}
+ }
+ if (C->isZero()) {
+ switch (Pred) {
+ case FCmpInst::FCMP_OGE:
+ if (FMF.noNaNs() && CannotBeOrderedLessThanZero(LHS, Q.TLI))
+ return getTrue(RetTy);
+ break;
+ case FCmpInst::FCMP_UGE:
+ if (CannotBeOrderedLessThanZero(LHS, Q.TLI))
+ return getTrue(RetTy);
+ break;
+ case FCmpInst::FCMP_ULT:
+ if (FMF.noNaNs() && CannotBeOrderedLessThanZero(LHS, Q.TLI))
+ return getFalse(RetTy);
+ break;
+ case FCmpInst::FCMP_OLT:
+ if (CannotBeOrderedLessThanZero(LHS, Q.TLI))
+ return getFalse(RetTy);
+ break;
+ default:
+ break;
+ }
} else if (C->isNegative()) {
assert(!C->isNaN() && "Unexpected NaN constant!");
// TODO: We can catch more cases by using a range check rather than
OpenPOWER on IntegriCloud