diff options
author | Chris Lattner <sabre@nondot.org> | 2003-10-05 05:34:39 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-10-05 05:34:39 +0000 |
commit | 92e4975af4a5582c9d38faa6130be81701a308da (patch) | |
tree | ffcec96d87fea4f9917c9f9bf6c01c32432c4508 /lib | |
parent | 3c881cb4ce4adc1765378360ba6383bdd64287f3 (diff) | |
download | external_llvm-92e4975af4a5582c9d38faa6130be81701a308da.zip external_llvm-92e4975af4a5582c9d38faa6130be81701a308da.tar.gz external_llvm-92e4975af4a5582c9d38faa6130be81701a308da.tar.bz2 |
The first PHI node may be null, scan for the first non-null one
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8865 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 0fa4a6a..06abc23 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -158,7 +158,10 @@ void PromoteMem2Reg::run() { // Only do work here if there the PHI nodes are missing incoming values. We // know that all PHI nodes that were inserted in a block will have the same // number of incoming values, so we can just check any PHI node. - PHINode *FirstPHI = PNs[0]; + PHINode *FirstPHI; + for (unsigned i = 0; (FirstPHI = PNs[i]) == 0; ++i) + /*empty*/; + if (Preds.size() != FirstPHI->getNumIncomingValues()) { // Ok, now we know that all of the PHI nodes are missing entries for some // basic blocks. Start by sorting the incoming predecessors for efficient |