[SCEV] Extract helper function from isImpliedCond; NFC
authorSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 25 Sep 2015 19:59:52 +0000 (19:59 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 25 Sep 2015 19:59:52 +0000 (19:59 +0000)
Summary:
This new helper routine will be used in a subsequent change.

Reviewers: hfinkel

Subscribers: hfinkel, sanjoy, llvm-commits

Differential Revision: http://reviews.llvm.org/D12949

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248607 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/ScalarEvolution.cpp

index f1efeb877fa1d8527dfe626801930963eab7b106..62d66c246d717bedfa2bee84fc1b48b18c664209 100644 (file)
@@ -506,6 +506,13 @@ namespace llvm {
                        Value *FoundCondValue,
                        bool Inverse);
 
+    /// Test whether the condition described by Pred, LHS, and RHS is true
+    /// whenever the condition described by FoundPred, FoundLHS, FoundRHS is
+    /// true.
+    bool isImpliedCond(ICmpInst::Predicate Pred, const SCEV *LHS,
+                       const SCEV *RHS, ICmpInst::Predicate FoundPred,
+                       const SCEV *FoundLHS, const SCEV *FoundRHS);
+
     /// Test whether the condition described by Pred, LHS, and RHS is true
     /// whenever the condition described by Pred, FoundLHS, and FoundRHS is
     /// true.
index a3763c354d2d3ae9bd419f62be9424665e616506..f87a5596c86689d6e812c82bf7a6e2fa6fb5beb0 100644 (file)
@@ -7151,6 +7151,14 @@ bool ScalarEvolution::isImpliedCond(ICmpInst::Predicate Pred,
   const SCEV *FoundLHS = getSCEV(ICI->getOperand(0));
   const SCEV *FoundRHS = getSCEV(ICI->getOperand(1));
 
+  return isImpliedCond(Pred, LHS, RHS, FoundPred, FoundLHS, FoundRHS);
+}
+
+bool ScalarEvolution::isImpliedCond(ICmpInst::Predicate Pred, const SCEV *LHS,
+                                    const SCEV *RHS,
+                                    ICmpInst::Predicate FoundPred,
+                                    const SCEV *FoundLHS,
+                                    const SCEV *FoundRHS) {
   // Balance the types.
   if (getTypeSizeInBits(LHS->getType()) <
       getTypeSizeInBits(FoundLHS->getType())) {