1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Fix a pessimization due to sucky LI testing

llvm-svn: 1412
This commit is contained in:
Chris Lattner 2001-12-04 08:12:47 +00:00
parent bd85988c94
commit 83d8d32cfa

View File

@ -127,6 +127,21 @@ InductionVariable::InductionVariable(PHINode *P, cfg::LoopInfo *LoopInfo) {
if (StepE.ExprTy != ExprType::Linear ||
StepE.Var != Phi) return;
const Type *ETy = Phi->getType();
if (ETy->isPointerType()) ETy = Type::ULongTy;
Step = (Value*)(StepE.Offset ? StepE.Offset : ConstantInt::get(ETy, 0));
} else { // We were able to get a step value, simplify with expr analysis
ExprType StepE = analysis::ClassifyExpression(Step);
if (StepE.ExprTy == ExprType::Linear && StepE.Offset == 0) {
// No offset from variable? Grab the variable
Step = StepE.Var;
} else if (StepE.ExprTy == ExprType::Constant) {
if (StepE.Offset)
Step = (Value*)StepE.Offset;
else
Step = Constant::getNullConstant(Step->getType());
}
const Type *ETy = Phi->getType();
if (ETy->isPointerType()) ETy = Type::ULongTy;
Step = (Value*)(StepE.Offset ? StepE.Offset : ConstantInt::get(ETy, 0));