summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2017-05-30 20:53:06 +0000
committerQuentin Colombet <qcolombet@apple.com>2017-05-30 20:53:06 +0000
commit73141d5b4b4604ebef55ac2c0e0043b0ab09b5f9 (patch)
tree286cb9ecba788e57c2064f427724a610c13f23b3 /llvm/lib/CodeGen
parente39709b20d3ee979fd0fb858e86d70e0668e02a4 (diff)
downloadbcm5719-llvm-73141d5b4b4604ebef55ac2c0e0043b0ab09b5f9.tar.gz
bcm5719-llvm-73141d5b4b4604ebef55ac2c0e0043b0ab09b5f9.zip
[Localizer] Don't trick to be smart for the insertion point
There is no guarantee that the first use of a constant that is traversed is actually the first in the related basic block. Thus, if we use that as the insertion point we may end up with definitions that don't dominate there use. llvm-svn: 304244
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/Localizer.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/Localizer.cpp b/llvm/lib/CodeGen/GlobalISel/Localizer.cpp
index c2a568e4b45..c5d0999fe43 100644
--- a/llvm/lib/CodeGen/GlobalISel/Localizer.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/Localizer.cpp
@@ -98,12 +98,10 @@ bool Localizer::runOnMachineFunction(MachineFunction &MF) {
// Create the localized instruction.
MachineInstr *LocalizedMI = MF.CloneMachineInstr(&MI);
LocalizedInstrs.insert(LocalizedMI);
- // Move it at the right place.
- MachineInstr &MIUse = *MOUse.getParent();
- if (MIUse.getParent() == InsertMBB)
- InsertMBB->insert(MIUse, LocalizedMI);
- else
- InsertMBB->insert(InsertMBB->getFirstNonPHI(), LocalizedMI);
+ // Don't try to be smart for the insertion point.
+ // There is no guarantee that the first seen use is the first
+ // use in the block.
+ InsertMBB->insert(InsertMBB->getFirstNonPHI(), LocalizedMI);
// Set a new register for the definition.
unsigned NewReg =
OpenPOWER on IntegriCloud