Value *CopyOf = CB.getOperand(0);
auto *PI = getPredicateInfoFor(&CB);
auto *PBranch = dyn_cast_or_null<PredicateBranch>(PI);
+ ValueLatticeElement OriginalVal = getValueState(CopyOf);
if (!PI || !PBranch) {
- mergeInValue(ValueState[&CB], &CB, getValueState(CopyOf));
+ mergeInValue(ValueState[&CB], &CB, OriginalVal);
return;
}
// Everything below relies on the condition being a comparison.
auto *Cmp = dyn_cast<CmpInst>(PBranch->Condition);
if (!Cmp) {
- mergeInValue(ValueState[&CB], &CB, getValueState(CopyOf));
+ mergeInValue(ValueState[&CB], &CB, OriginalVal);
return;
}
Value *CmpOp0 = Cmp->getOperand(0);
Value *CmpOp1 = Cmp->getOperand(1);
if (CopyOf != CmpOp0 && CopyOf != CmpOp1) {
- mergeInValue(ValueState[&CB], &CB, getValueState(CopyOf));
+ mergeInValue(ValueState[&CB], &CB, OriginalVal);
return;
}
ValueLatticeElement CondVal = getValueState(CmpOp1);
ValueLatticeElement &IV = ValueState[&CB];
- ValueLatticeElement OriginalVal = getValueState(CopyOf);
if (CondVal.isConstantRange() || OriginalVal.isConstantRange()) {
auto NewCR =
ConstantRange::getFull(DL.getTypeSizeInBits(CopyOf->getType()));
return;
}
- return (void)mergeInValue(IV, &CB, getValueState(CopyOf));
+ return (void)mergeInValue(IV, &CB, OriginalVal);
}
}