aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineSSAUpdater.cpp
diff options
context:
space:
mode:
authorNicolai Haehnle <nhaehnle@gmail.com>2019-10-08 12:46:20 +0000
committerNicolai Haehnle <nhaehnle@gmail.com>2019-10-08 12:46:20 +0000
commit7febdb7f27dfd3c5aab75ee07e1d36d30124fecc (patch)
tree22d794606b9f046b83e49791ae17232a4fd62824 /llvm/lib/CodeGen/MachineSSAUpdater.cpp
parent5cce533525d6d5174da796622a79bada6b48bba3 (diff)
downloadllvm-7febdb7f27dfd3c5aab75ee07e1d36d30124fecc.zip
llvm-7febdb7f27dfd3c5aab75ee07e1d36d30124fecc.tar.gz
llvm-7febdb7f27dfd3c5aab75ee07e1d36d30124fecc.tar.bz2
MachineSSAUpdater: insert IMPLICIT_DEF at top of basic block
Summary: When getValueInMiddleOfBlock happens to be called for a basic block that has no incoming value at all, an IMPLICIT_DEF is inserted in that block via GetValueAtEndOfBlockInternal. This IMPLICIT_DEF must be at the top of its basic block or it will likely not reach the use that the caller intends to insert. Issue: https://github.com/GPUOpen-Drivers/llpc/issues/204 Reviewers: arsenm, rampitec Subscribers: jvesely, wdng, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68183 llvm-svn: 374040
Diffstat (limited to 'llvm/lib/CodeGen/MachineSSAUpdater.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineSSAUpdater.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineSSAUpdater.cpp b/llvm/lib/CodeGen/MachineSSAUpdater.cpp
index 3370b52..258a5f9 100644
--- a/llvm/lib/CodeGen/MachineSSAUpdater.cpp
+++ b/llvm/lib/CodeGen/MachineSSAUpdater.cpp
@@ -292,7 +292,7 @@ public:
MachineSSAUpdater *Updater) {
// Insert an implicit_def to represent an undef value.
MachineInstr *NewDef = InsertNewDef(TargetOpcode::IMPLICIT_DEF,
- BB, BB->getFirstTerminator(),
+ BB, BB->getFirstNonPHI(),
Updater->VRC, Updater->MRI,
Updater->TII);
return NewDef->getOperand(0).getReg();