return getUnknown(
ConstantExpr::getTrunc(SC->getValue(), Ty));
+ // trunc(trunc(x)) --> trunc(x)
+ if (SCEVTruncateExpr *ST = dyn_cast<SCEVTruncateExpr>(Op))
+ return getTruncateExpr(ST->getOperand(), Ty);
+
// If the input value is a chrec scev made out of constants, truncate
// all of the constants.
if (SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(Op)) {
return getUnknown(C);
}
+ // zext(zext(x)) --> zext(x)
+ if (SCEVZeroExtendExpr *SZ = dyn_cast<SCEVZeroExtendExpr>(Op))
+ return getZeroExtendExpr(SZ->getOperand(), Ty);
+
// FIXME: If the input value is a chrec scev, and we can prove that the value
// did not overflow the old, smaller, value, we can zero extend all of the
// operands (often constants). This would allow analysis of something like
return getUnknown(C);
}
+ // sext(sext(x)) --> sext(x)
+ if (SCEVSignExtendExpr *SS = dyn_cast<SCEVSignExtendExpr>(Op))
+ return getSignExtendExpr(SS->getOperand(), Ty);
+
// FIXME: If the input value is a chrec scev, and we can prove that the value
// did not overflow the old, smaller, value, we can sign extend all of the
// operands (often constants). This would allow analysis of something like