diff options
| author | Craig Topper <craig.topper@intel.com> | 2017-06-09 21:18:16 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@intel.com> | 2017-06-09 21:18:16 +0000 |
| commit | 6dd9dcf26e0e55050da9a2bf4e7d4738816a1373 (patch) | |
| tree | 88ec46536f316ef21735432e7fc036d82558e4cd /llvm/lib/Analysis | |
| parent | 384f704834407f8e65432afa2438f4f046197608 (diff) | |
| download | bcm5719-llvm-6dd9dcf26e0e55050da9a2bf4e7d4738816a1373.tar.gz bcm5719-llvm-6dd9dcf26e0e55050da9a2bf4e7d4738816a1373.zip | |
[LVI] Const correct and rename the LVILatticeVal parameter to getPredicateResult. NFC
Previously it was non-const reference named Result which would tend to make someone think that it was an outparam when really its an input.
llvm-svn: 305114
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/LazyValueInfo.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp index de5d80b2dd5..9fd196e4156 100644 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/lib/Analysis/LazyValueInfo.cpp @@ -1661,25 +1661,24 @@ Constant *LazyValueInfo::getConstantOnEdge(Value *V, BasicBlock *FromBB, } static LazyValueInfo::Tristate getPredicateResult(unsigned Pred, Constant *C, - LVILatticeVal &Result, + const LVILatticeVal &Val, const DataLayout &DL, TargetLibraryInfo *TLI) { // If we know the value is a constant, evaluate the conditional. Constant *Res = nullptr; - if (Result.isConstant()) { - Res = ConstantFoldCompareInstOperands(Pred, Result.getConstant(), C, DL, - TLI); + if (Val.isConstant()) { + Res = ConstantFoldCompareInstOperands(Pred, Val.getConstant(), C, DL, TLI); if (ConstantInt *ResCI = dyn_cast<ConstantInt>(Res)) return ResCI->isZero() ? LazyValueInfo::False : LazyValueInfo::True; return LazyValueInfo::Unknown; } - if (Result.isConstantRange()) { + if (Val.isConstantRange()) { ConstantInt *CI = dyn_cast<ConstantInt>(C); if (!CI) return LazyValueInfo::Unknown; - const ConstantRange &CR = Result.getConstantRange(); + const ConstantRange &CR = Val.getConstantRange(); if (Pred == ICmpInst::ICMP_EQ) { if (!CR.contains(CI->getValue())) return LazyValueInfo::False; @@ -1704,20 +1703,20 @@ static LazyValueInfo::Tristate getPredicateResult(unsigned Pred, Constant *C, return LazyValueInfo::Unknown; } - if (Result.isNotConstant()) { + if (Val.isNotConstant()) { // If this is an equality comparison, we can try to fold it knowing that // "V != C1". if (Pred == ICmpInst::ICMP_EQ) { // !C1 == C -> false iff C1 == C. Res = ConstantFoldCompareInstOperands(ICmpInst::ICMP_NE, - Result.getNotConstant(), C, DL, + Val.getNotConstant(), C, DL, TLI); if (Res->isNullValue()) return LazyValueInfo::False; } else if (Pred == ICmpInst::ICMP_NE) { // !C1 != C -> true iff C1 == C. Res = ConstantFoldCompareInstOperands(ICmpInst::ICMP_NE, - Result.getNotConstant(), C, DL, + Val.getNotConstant(), C, DL, TLI); if (Res->isNullValue()) return LazyValueInfo::True; |

