diff options
| author | Nick Lewycky <nicholas@mxc.ca> | 2009-10-25 03:50:03 +0000 |
|---|---|---|
| committer | Nick Lewycky <nicholas@mxc.ca> | 2009-10-25 03:50:03 +0000 |
| commit | 36d0d2030275df7b40226a7979c6d7424955a2f6 (patch) | |
| tree | 3dc81ac9fed1799f51742701c4b7ec2fd5e03e21 /lib | |
| parent | 83410aa8c59837bafd2fcab76c33abd14e72b5c1 (diff) | |
| download | external_llvm-36d0d2030275df7b40226a7979c6d7424955a2f6.zip external_llvm-36d0d2030275df7b40226a7979c6d7424955a2f6.tar.gz external_llvm-36d0d2030275df7b40226a7979c6d7424955a2f6.tar.bz2 | |
Sink isTrueWhenEqual from ICmpInst to CmpInst. Add a matching isFalseWhenEqual
which is equal to !isTrueWhenEqual for ints but not for floats.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85036 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/VMCore/Instructions.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index 60e203a..b73ce50 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -2943,7 +2943,7 @@ bool CmpInst::isUnsigned(unsigned short predicate) { } } -bool CmpInst::isSigned(unsigned short predicate){ +bool CmpInst::isSigned(unsigned short predicate) { switch (predicate) { default: return false; case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_SLE: case ICmpInst::ICMP_SGT: @@ -2969,6 +2969,23 @@ bool CmpInst::isUnordered(unsigned short predicate) { } } +bool CmpInst::isTrueWhenEqual(unsigned short predicate) { + switch(predicate) { + default: return false; + case ICMP_EQ: case ICMP_UGE: case ICMP_ULE: case ICMP_SGE: case ICMP_SLE: + case FCMP_TRUE: case FCMP_UEQ: case FCMP_UGE: case FCMP_ULE: return true; + } +} + +bool CmpInst::isFalseWhenEqual(unsigned short predicate) { + switch(predicate) { + case ICMP_NE: case ICMP_UGT: case ICMP_ULT: case ICMP_SGT: case ICMP_SLT: + case FCMP_FALSE: case FCMP_ONE: case FCMP_OGT: case FCMP_OLT: return true; + default: return false; + } +} + + //===----------------------------------------------------------------------===// // SwitchInst Implementation //===----------------------------------------------------------------------===// |
