mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-18 12:29:21 +00:00
Fix a pessimization due to sucky LI testing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1412 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
394437ff7e
commit
621c9920c7
@ -127,6 +127,21 @@ InductionVariable::InductionVariable(PHINode *P, cfg::LoopInfo *LoopInfo) {
|
|||||||
if (StepE.ExprTy != ExprType::Linear ||
|
if (StepE.ExprTy != ExprType::Linear ||
|
||||||
StepE.Var != Phi) return;
|
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();
|
const Type *ETy = Phi->getType();
|
||||||
if (ETy->isPointerType()) ETy = Type::ULongTy;
|
if (ETy->isPointerType()) ETy = Type::ULongTy;
|
||||||
Step = (Value*)(StepE.Offset ? StepE.Offset : ConstantInt::get(ETy, 0));
|
Step = (Value*)(StepE.Offset ? StepE.Offset : ConstantInt::get(ETy, 0));
|
||||||
|
Loading…
Reference in New Issue
Block a user