diff options
author | Pete Cooper <peter_cooper@apple.com> | 2015-05-12 20:05:31 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2015-05-12 20:05:31 +0000 |
commit | 833f34d837eca1e11370fbdea0bcbae10fee70b7 (patch) | |
tree | 715708db84c3689da9353f39f85088f86359bbe1 /llvm/lib/Analysis/ConstantFolding.cpp | |
parent | 26b7aa020bdcabd10ba1c81226327007321aeb89 (diff) | |
download | llvm-833f34d837eca1e11370fbdea0bcbae10fee70b7.zip llvm-833f34d837eca1e11370fbdea0bcbae10fee70b7.tar.gz llvm-833f34d837eca1e11370fbdea0bcbae10fee70b7.tar.bz2 |
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.
llvm-svn: 237169
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 6a37f95..85a6633 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -895,8 +895,7 @@ Constant *llvm::ConstantFoldInstruction(Instruction *I, const DataLayout &DL, if (PHINode *PN = dyn_cast<PHINode>(I)) { Constant *CommonValue = nullptr; - for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { - Value *Incoming = PN->getIncomingValue(i); + for (Value *Incoming : PN->incoming_values()) { // If the incoming value is undef then skip it. Note that while we could // skip the value if it is equal to the phi node itself we choose not to // because that would break the rule that constant folding only applies if |