summaryrefslogtreecommitdiff
path: root/lib/CodeGen/GlobalISel/Localizer.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-06-01 20:58:36 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-06-01 20:58:36 +0000
commitf382538d471e38a9b98f016c4caebd24c8d60b62 (patch)
treed30f3d58b1044b5355d50c17a6a96c6a0b35703a /lib/CodeGen/GlobalISel/Localizer.cpp
parentee2f195dd3e40f49698ca4dc2666ec09c770e80d (diff)
Notes
Diffstat (limited to 'lib/CodeGen/GlobalISel/Localizer.cpp')
-rw-r--r--lib/CodeGen/GlobalISel/Localizer.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/CodeGen/GlobalISel/Localizer.cpp b/lib/CodeGen/GlobalISel/Localizer.cpp
index c2a568e4b452..c5d0999fe438 100644
--- a/lib/CodeGen/GlobalISel/Localizer.cpp
+++ b/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 =