mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 07:24:25 +00:00
Put all IVUsers in the processed set. Allow querying IVUsers with isIVUserOrOperand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147686 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -166,6 +166,10 @@ public:
|
|||||||
const_iterator end() const { return IVUses.end(); }
|
const_iterator end() const { return IVUses.end(); }
|
||||||
bool empty() const { return IVUses.empty(); }
|
bool empty() const { return IVUses.empty(); }
|
||||||
|
|
||||||
|
bool isIVUserOrOperand(Instruction *Inst) const {
|
||||||
|
return Processed.count(Inst);
|
||||||
|
}
|
||||||
|
|
||||||
void print(raw_ostream &OS, const Module* = 0) const;
|
void print(raw_ostream &OS, const Module* = 0) const;
|
||||||
|
|
||||||
/// dump - This method is used for debugging.
|
/// dump - This method is used for debugging.
|
||||||
|
@ -83,6 +83,11 @@ static bool isInteresting(const SCEV *S, const Instruction *I, const Loop *L,
|
|||||||
/// reducible SCEV, recursively add its users to the IVUsesByStride set and
|
/// reducible SCEV, recursively add its users to the IVUsesByStride set and
|
||||||
/// return true. Otherwise, return false.
|
/// return true. Otherwise, return false.
|
||||||
bool IVUsers::AddUsersIfInteresting(Instruction *I) {
|
bool IVUsers::AddUsersIfInteresting(Instruction *I) {
|
||||||
|
// Add this IV user to the Processed set before returning false to ensure that
|
||||||
|
// all IV users are members of the set. See IVUsers::isIVUserOrOperand.
|
||||||
|
if (!Processed.insert(I))
|
||||||
|
return true; // Instruction already handled.
|
||||||
|
|
||||||
if (!SE->isSCEVable(I->getType()))
|
if (!SE->isSCEVable(I->getType()))
|
||||||
return false; // Void and FP expressions cannot be reduced.
|
return false; // Void and FP expressions cannot be reduced.
|
||||||
|
|
||||||
@ -93,9 +98,6 @@ bool IVUsers::AddUsersIfInteresting(Instruction *I) {
|
|||||||
if (Width > 64 || (TD && !TD->isLegalInteger(Width)))
|
if (Width > 64 || (TD && !TD->isLegalInteger(Width)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Processed.insert(I))
|
|
||||||
return true; // Instruction already handled.
|
|
||||||
|
|
||||||
// Get the symbolic expression for this instruction.
|
// Get the symbolic expression for this instruction.
|
||||||
const SCEV *ISE = SE->getSCEV(I);
|
const SCEV *ISE = SE->getSCEV(I);
|
||||||
|
|
||||||
@ -268,6 +270,7 @@ void IVStrideUse::transformToPostInc(const Loop *L) {
|
|||||||
|
|
||||||
void IVStrideUse::deleted() {
|
void IVStrideUse::deleted() {
|
||||||
// Remove this user from the list.
|
// Remove this user from the list.
|
||||||
|
Parent->Processed.erase(this->getUser());
|
||||||
Parent->IVUses.erase(this);
|
Parent->IVUses.erase(this);
|
||||||
// this now dangles!
|
// this now dangles!
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user