summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-10-22 19:57:34 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-10-22 19:57:34 +0000
commit6e78b17b43f41fba47a7c53483604ca2fabc8d64 (patch)
treef994df4a63d79e36a9053b8c29b10621135f7936 /llvm/include
parent1123148d40691a9ce08879fff878a02acd0f6822 (diff)
downloadbcm5719-llvm-6e78b17b43f41fba47a7c53483604ca2fabc8d64.tar.gz
bcm5719-llvm-6e78b17b43f41fba47a7c53483604ca2fabc8d64.zip
[SCEV] Opportunistically interpret unsigned constraints as signed
Summary: An unsigned comparision is equivalent to is corresponding signed version if both the operands being compared are positive. Teach SCEV to use this fact when profitable. Reviewers: atrick, hfinkel, reames, nlewycky Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D13687 llvm-svn: 251051
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/IR/InstrTypes.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index 207b5b42d50..19106114880 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -1033,6 +1033,19 @@ public:
return isUnsigned(getPredicate());
}
+ /// For example, ULT->SLT, ULE->SLE, UGT->SGT, UGE->SGE, SLT->Failed assert
+ /// @returns the signed version of the unsigned predicate pred.
+ /// @brief return the signed version of a predicate
+ static Predicate getSignedPredicate(Predicate pred);
+
+ /// For example, ULT->SLT, ULE->SLE, UGT->SGT, UGE->SGE, SLT->Failed assert
+ /// @returns the signed version of the predicate for this instruction (which
+ /// has to be an unsigned predicate).
+ /// @brief return the signed version of a predicate
+ Predicate getSignedPredicate() {
+ return getSignedPredicate(getPredicate());
+ }
+
/// This is just a convenience.
/// @brief Determine if this is true when both operands are the same.
bool isTrueWhenEqual() const {
OpenPOWER on IntegriCloud