mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 23:29:20 +00:00
Move the memoization check for SCEVSignExtendExpr and
SCEVZeroExtendExpr ahead of the most expensive analysis. This speeds up analysis and helps avoid pathologically bad behavior on the testcase in PR4534. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75496 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7e25d45cfb
commit
69fbc7f477
@ -772,6 +772,15 @@ const SCEV *ScalarEvolution::getZeroExtendExpr(const SCEV *Op,
|
||||
if (const SCEVZeroExtendExpr *SZ = dyn_cast<SCEVZeroExtendExpr>(Op))
|
||||
return getZeroExtendExpr(SZ->getOperand(), Ty);
|
||||
|
||||
// Before doing any expensive analysis, check to see if we've already
|
||||
// computed a SCEV for this Op and Ty.
|
||||
FoldingSetNodeID ID;
|
||||
ID.AddInteger(scZeroExtend);
|
||||
ID.AddPointer(Op);
|
||||
ID.AddPointer(Ty);
|
||||
void *IP = 0;
|
||||
if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S;
|
||||
|
||||
// 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 allows analysis of something like
|
||||
@ -836,11 +845,8 @@ const SCEV *ScalarEvolution::getZeroExtendExpr(const SCEV *Op,
|
||||
}
|
||||
}
|
||||
|
||||
FoldingSetNodeID ID;
|
||||
ID.AddInteger(scZeroExtend);
|
||||
ID.AddPointer(Op);
|
||||
ID.AddPointer(Ty);
|
||||
void *IP = 0;
|
||||
// The cast wasn't folded; create an explicit cast node.
|
||||
// Recompute the insert position, as it may have been invalidated.
|
||||
if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S;
|
||||
SCEV *S = SCEVAllocator.Allocate<SCEVZeroExtendExpr>();
|
||||
new (S) SCEVZeroExtendExpr(ID, Op, Ty);
|
||||
@ -868,6 +874,15 @@ const SCEV *ScalarEvolution::getSignExtendExpr(const SCEV *Op,
|
||||
if (const SCEVSignExtendExpr *SS = dyn_cast<SCEVSignExtendExpr>(Op))
|
||||
return getSignExtendExpr(SS->getOperand(), Ty);
|
||||
|
||||
// Before doing any expensive analysis, check to see if we've already
|
||||
// computed a SCEV for this Op and Ty.
|
||||
FoldingSetNodeID ID;
|
||||
ID.AddInteger(scSignExtend);
|
||||
ID.AddPointer(Op);
|
||||
ID.AddPointer(Ty);
|
||||
void *IP = 0;
|
||||
if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S;
|
||||
|
||||
// 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 allows analysis of something like
|
||||
@ -916,11 +931,8 @@ const SCEV *ScalarEvolution::getSignExtendExpr(const SCEV *Op,
|
||||
}
|
||||
}
|
||||
|
||||
FoldingSetNodeID ID;
|
||||
ID.AddInteger(scSignExtend);
|
||||
ID.AddPointer(Op);
|
||||
ID.AddPointer(Ty);
|
||||
void *IP = 0;
|
||||
// The cast wasn't folded; create an explicit cast node.
|
||||
// Recompute the insert position, as it may have been invalidated.
|
||||
if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S;
|
||||
SCEV *S = SCEVAllocator.Allocate<SCEVSignExtendExpr>();
|
||||
new (S) SCEVSignExtendExpr(ID, Op, Ty);
|
||||
|
Loading…
x
Reference in New Issue
Block a user