mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-06 01:24:35 +00:00
Convert PHI getIncomingValue() to foreach over incoming_values(). NFC.
We already had a method to iterate over all the incoming values of a PHI. This just changes all eligible code to use it. Ineligible code included anything which cared about the index, or was also trying to get the i'th incoming BB. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237169 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1429,15 +1429,15 @@ void computeKnownBits(Value *V, APInt &KnownZero, APInt &KnownOne,
|
||||
|
||||
KnownZero = APInt::getAllOnesValue(BitWidth);
|
||||
KnownOne = APInt::getAllOnesValue(BitWidth);
|
||||
for (unsigned i = 0, e = P->getNumIncomingValues(); i != e; ++i) {
|
||||
for (Value *IncValue : P->incoming_values()) {
|
||||
// Skip direct self references.
|
||||
if (P->getIncomingValue(i) == P) continue;
|
||||
if (IncValue == P) continue;
|
||||
|
||||
KnownZero2 = APInt(BitWidth, 0);
|
||||
KnownOne2 = APInt(BitWidth, 0);
|
||||
// Recurse, but cap the recursion to one level, because we don't
|
||||
// want to waste time spinning around in loops.
|
||||
computeKnownBits(P->getIncomingValue(i), KnownZero2, KnownOne2, DL,
|
||||
computeKnownBits(IncValue, KnownZero2, KnownOne2, DL,
|
||||
MaxDepth - 1, Q);
|
||||
KnownZero &= KnownZero2;
|
||||
KnownOne &= KnownOne2;
|
||||
@ -2691,8 +2691,8 @@ static uint64_t GetStringLengthH(Value *V, SmallPtrSetImpl<PHINode*> &PHIs) {
|
||||
|
||||
// If it was new, see if all the input strings are the same length.
|
||||
uint64_t LenSoFar = ~0ULL;
|
||||
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
|
||||
uint64_t Len = GetStringLengthH(PN->getIncomingValue(i), PHIs);
|
||||
for (Value *IncValue : PN->incoming_values()) {
|
||||
uint64_t Len = GetStringLengthH(IncValue, PHIs);
|
||||
if (Len == 0) return 0; // Unknown length -> unknown.
|
||||
|
||||
if (Len == ~0ULL) continue;
|
||||
@ -2826,8 +2826,8 @@ void llvm::GetUnderlyingObjects(Value *V, SmallVectorImpl<Value *> &Objects,
|
||||
// underlying objects.
|
||||
if (!LI || !LI->isLoopHeader(PN->getParent()) ||
|
||||
isSameUnderlyingObjectInLoop(PN, LI))
|
||||
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
|
||||
Worklist.push_back(PN->getIncomingValue(i));
|
||||
for (Value *IncValue : PN->incoming_values())
|
||||
Worklist.push_back(IncValue);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user