mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-25 12:04:36 +00:00
[LVI] NFC. On the fast dest path use inverse predicate instead of inverse range result
Gathering constantins from a condition on the false path ask makeAllowedICmpRegion about inverse predicate instead of inversing the resulting range. This change was separated from the review "[LVI] Make LVI smarter about comparisons with non-constants" (https://reviews.llvm.org/D23205#inline-198361) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278009 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b827587818
commit
fe11e980a9
@ -1208,15 +1208,16 @@ bool getValueFromCondition(Value *Val, Value *Cond, LVILatticeVal &Result,
|
||||
if (CI && (LHS == Val || Offset)) {
|
||||
// Calculate the range of values that are allowed by the comparison
|
||||
ConstantRange CmpRange(CI->getValue());
|
||||
|
||||
// If we're interested in the false dest, invert the condition
|
||||
CmpInst::Predicate Pred =
|
||||
isTrueDest ? Predicate : CmpInst::getInversePredicate(Predicate);
|
||||
ConstantRange TrueValues =
|
||||
ConstantRange::makeAllowedICmpRegion(Predicate, CmpRange);
|
||||
ConstantRange::makeAllowedICmpRegion(Pred, CmpRange);
|
||||
|
||||
if (Offset) // Apply the offset from above.
|
||||
TrueValues = TrueValues.subtract(Offset->getValue());
|
||||
|
||||
// If we're interested in the false dest, invert the condition.
|
||||
if (!isTrueDest) TrueValues = TrueValues.inverse();
|
||||
|
||||
Result = LVILatticeVal::getRange(std::move(TrueValues));
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user