aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveVariables.cpp
diff options
context:
space:
mode:
authorKang Zhang <shkzhang@cn.ibm.com>2020-06-03 15:25:30 +0000
committerKang Zhang <shkzhang@cn.ibm.com>2020-06-03 15:25:30 +0000
commit2cc77b2b8a022c0f6c7c60bf3eda157f62007d88 (patch)
tree24b5159585a1744fb07c30ff3f7e6626589a44a6 /llvm/lib/CodeGen/LiveVariables.cpp
parentc57e41c000c40e2efd441bc819b472feb49c94bf (diff)
downloadllvm-2cc77b2b8a022c0f6c7c60bf3eda157f62007d88.zip
llvm-2cc77b2b8a022c0f6c7c60bf3eda157f62007d88.tar.gz
llvm-2cc77b2b8a022c0f6c7c60bf3eda157f62007d88.tar.bz2
[LiveVariables] Don't set undef reg PHI used as live for FromMBB
Summary: In the patch D73152, it adds a new function LiveVariables::addNewBlock. This new function will add the reg which PHI used to the MBB which reg is from. But the new function may cause LiveVariable Verification failed when the Src reg in PHI is undef. Reviewed By: bjope Differential Revision: https://reviews.llvm.org/D80077
Diffstat (limited to 'llvm/lib/CodeGen/LiveVariables.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveVariables.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveVariables.cpp b/llvm/lib/CodeGen/LiveVariables.cpp
index 7e89471..6610491 100644
--- a/llvm/lib/CodeGen/LiveVariables.cpp
+++ b/llvm/lib/CodeGen/LiveVariables.cpp
@@ -828,7 +828,8 @@ void LiveVariables::addNewBlock(MachineBasicBlock *BB,
BBE = SuccBB->end();
BBI != BBE && BBI->isPHI(); ++BBI) {
for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
- if (BBI->getOperand(i + 1).getMBB() == BB)
+ if (BBI->getOperand(i + 1).getMBB() == BB &&
+ BBI->getOperand(i).readsReg())
getVarInfo(BBI->getOperand(i).getReg())
.AliveBlocks.set(NumNew);
}