summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2018-02-27 09:34:51 +0000
committerFlorian Hahn <florian.hahn@arm.com>2018-02-27 09:34:51 +0000
commit1807c516c77eb2b66ee84cba56435897c913812d (patch)
tree48d90d6bc49bd7a4f1ca7b427dcb373cd286c782 /llvm/lib/Transforms
parentf9b3c67956ef81342ca748398ca6c6aacd88d7ca (diff)
downloadbcm5719-llvm-1807c516c77eb2b66ee84cba56435897c913812d.tar.gz
bcm5719-llvm-1807c516c77eb2b66ee84cba56435897c913812d.zip
[NewGVN] Update phi-of-ops def block when updating existing ValuePHI.
In case we update a ValuePHI node created earlier, we could update it based on a different OpPHI which could be in a different block. We need to update the TempToBlock mapping reflecting the new block, otherwise we would end up placing the new phi node in a wrong block. This problem is exposed by the test case in https://bugs.llvm.org/show_bug.cgi?id=36504. This patch fixes a slightly simpler problem than in the bug report. In the bug's re-producer, the additional problem is that we are re-using a ValuePHI node with to few incoming values for the new OpPHI. If this patch makes sense, I will follow it up with a patch that creates a new PHI node if the existing PHI node has a different number of incoming values. Reviewers: davide, dberlin Reviewed By: dberlin Differential Revision: https://reviews.llvm.org/D43770 llvm-svn: 326181
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/NewGVN.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp
index 5e6b58055ec..2a58d0b4383 100644
--- a/llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -2819,6 +2819,7 @@ NewGVN::makePossiblePHIOfOps(Instruction *I,
for (auto PHIOp : Ops)
ValuePHI->addIncoming(PHIOp.first, PHIOp.second);
} else {
+ TempToBlock[ValuePHI] = PHIBlock;
unsigned int i = 0;
for (auto PHIOp : Ops) {
ValuePHI->setIncomingValue(i, PHIOp.first);
OpenPOWER on IntegriCloud