diff options
| author | Philip Reames <listmail@philipreames.com> | 2016-12-06 02:54:16 +0000 | 
|---|---|---|
| committer | Philip Reames <listmail@philipreames.com> | 2016-12-06 02:54:16 +0000 | 
| commit | b29496246f72afd1772a257ce1ce7ee95168c684 (patch) | |
| tree | 7d2a5f6690b99cdacff5ee901c55ba9f125e9f36 /llvm/lib/Analysis | |
| parent | 9a561aa34c8f2553cb2ce1df5c3922594842148d (diff) | |
| download | bcm5719-llvm-b29496246f72afd1772a257ce1ce7ee95168c684.tar.gz bcm5719-llvm-b29496246f72afd1772a257ce1ce7ee95168c684.zip  | |
[LVI] Hide a confusing internal interface
llvm-svn: 288764
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/LazyValueInfo.cpp | 35 | 
1 files changed, 19 insertions, 16 deletions
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp index fb7c949e12d..856238bda2e 100644 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/lib/Analysis/LazyValueInfo.cpp @@ -148,6 +148,7 @@ public:      return true;    } +private:    /// Return true if this is a change in status.    bool markConstant(Constant *V) {      assert(V && "Marking constant with NULL"); @@ -202,6 +203,8 @@ public:      return true;    } +public: +    /// Merge the specified lattice value into this one, updating this    /// one and returning true if anything changed.    bool mergeIn(const LVILatticeVal &RHS, const DataLayout &DL) { @@ -1028,22 +1031,22 @@ bool LazyValueInfoImpl::solveBlockValueSelect(LVILatticeVal &BBLV,      // ValueTracking getting smarter looking back past our immediate inputs.)      if (SelectPatternResult::isMinOrMax(SPR.Flavor) &&          LHS == SI->getTrueValue() && RHS == SI->getFalseValue()) { -      switch (SPR.Flavor) { -      default: -        llvm_unreachable("unexpected minmax type!"); -      case SPF_SMIN:                   /// Signed minimum -        BBLV.markConstantRange(TrueCR.smin(FalseCR)); -        return true; -      case SPF_UMIN:                   /// Unsigned minimum -        BBLV.markConstantRange(TrueCR.umin(FalseCR)); -        return true; -      case SPF_SMAX:                   /// Signed maximum -        BBLV.markConstantRange(TrueCR.smax(FalseCR)); -        return true; -      case SPF_UMAX:                   /// Unsigned maximum -        BBLV.markConstantRange(TrueCR.umax(FalseCR)); -        return true; -      }; +      ConstantRange ResultCR = [&]() { +        switch (SPR.Flavor) { +        default: +          llvm_unreachable("unexpected minmax type!"); +        case SPF_SMIN:                   /// Signed minimum +          return TrueCR.smin(FalseCR); +        case SPF_UMIN:                   /// Unsigned minimum +          return TrueCR.umin(FalseCR); +        case SPF_SMAX:                   /// Signed maximum +          return TrueCR.smax(FalseCR); +        case SPF_UMAX:                   /// Unsigned maximum +          return TrueCR.umax(FalseCR); +        }; +      }(); +      BBLV = LVILatticeVal::getRange(ResultCR); +      return true;      }      // TODO: ABS, NABS from the SelectPatternResult  | 

