[llvm] r249764 - AArch64: Stop using MachineInstr::getNextNode()

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 15:43:27 PDT 2015


Author: dexonsmith
Date: Thu Oct  8 17:43:26 2015
New Revision: 249764

URL: http://llvm.org/viewvc/llvm-project?rev=249764&view=rev
Log:
AArch64: Stop using MachineInstr::getNextNode()

Stop using `getNextNode()` to get an insertion point (at least, in this
one place).  Instead, use iterator logic directly.

The `getNextNode()` interface isn't actually supposed to work for
creating iterators; it's supposed to return `nullptr` (not a real
iterator) if this is the last node.  It's currently broken and will
"happen" to work, but if we ever fix the function, we'll get some
strange failures in places like this.

Modified:
    llvm/trunk/lib/Target/AArch64/AArch64CleanupLocalDynamicTLSPass.cpp

Modified: llvm/trunk/lib/Target/AArch64/AArch64CleanupLocalDynamicTLSPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64CleanupLocalDynamicTLSPass.cpp?rev=249764&r1=249763&r2=249764&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64CleanupLocalDynamicTLSPass.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64CleanupLocalDynamicTLSPass.cpp Thu Oct  8 17:43:26 2015
@@ -117,10 +117,10 @@ struct LDTLSCleanup : public MachineFunc
     *TLSBaseAddrReg = RegInfo.createVirtualRegister(&AArch64::GPR64RegClass);
 
     // Insert a copy from X0 to TLSBaseAddrReg for later.
-    MachineInstr *Next = I->getNextNode();
-    MachineInstr *Copy = BuildMI(*I->getParent(), Next, I->getDebugLoc(),
-                                 TII->get(TargetOpcode::COPY),
-                                 *TLSBaseAddrReg).addReg(AArch64::X0);
+    MachineInstr *Copy =
+        BuildMI(*I->getParent(), ++MachineBasicBlock::iterator(I),
+                I->getDebugLoc(), TII->get(TargetOpcode::COPY), *TLSBaseAddrReg)
+            .addReg(AArch64::X0);
 
     return Copy;
   }




More information about the llvm-commits mailing list