[PATCH] D83540: [NFC] Change isFPPredicate comparison to ignore lower bound
David Stuttard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 10 04:12:26 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG69a89b54c626: [NFC] Change isFPPredicate comparison to ignore lower bound (authored by dstuttard).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83540/new/
https://reviews.llvm.org/D83540
Files:
llvm/include/llvm/IR/InstrTypes.h
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
Index: llvm/lib/Target/AMDGPU/SIISelLowering.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -4567,8 +4567,7 @@
EVT VT = N->getValueType(0);
const auto *CD = cast<ConstantSDNode>(N->getOperand(3));
unsigned CondCode = CD->getZExtValue();
- if (CondCode < ICmpInst::Predicate::FIRST_ICMP_PREDICATE ||
- CondCode > ICmpInst::Predicate::LAST_ICMP_PREDICATE)
+ if (!ICmpInst::isIntPredicate(static_cast<ICmpInst::Predicate>(CondCode)))
return DAG.getUNDEF(VT);
ICmpInst::Predicate IcInput = static_cast<ICmpInst::Predicate>(CondCode);
@@ -4604,10 +4603,8 @@
const auto *CD = cast<ConstantSDNode>(N->getOperand(3));
unsigned CondCode = CD->getZExtValue();
- if (CondCode < FCmpInst::Predicate::FIRST_FCMP_PREDICATE ||
- CondCode > FCmpInst::Predicate::LAST_FCMP_PREDICATE) {
+ if (!FCmpInst::isFPPredicate(static_cast<FCmpInst::Predicate>(CondCode)))
return DAG.getUNDEF(VT);
- }
SDValue Src0 = N->getOperand(1);
SDValue Src1 = N->getOperand(2);
Index: llvm/include/llvm/IR/InstrTypes.h
===================================================================
--- llvm/include/llvm/IR/InstrTypes.h
+++ llvm/include/llvm/IR/InstrTypes.h
@@ -805,7 +805,9 @@
void setPredicate(Predicate P) { setSubclassData<PredicateField>(P); }
static bool isFPPredicate(Predicate P) {
- return P >= FIRST_FCMP_PREDICATE && P <= LAST_FCMP_PREDICATE;
+ assert(FIRST_FCMP_PREDICATE == 0 &&
+ "FIRST_FCMP_PREDICATE is required to be 0");
+ return P <= LAST_FCMP_PREDICATE;
}
static bool isIntPredicate(Predicate P) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83540.276981.patch
Type: text/x-patch
Size: 1695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200710/5ce29efd/attachment.bin>
More information about the llvm-commits
mailing list