[llvm] r249764 - AArch64: Stop using MachineInstr::getNextNode()
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 9 09:58:50 PDT 2015
`I` is not a `MachineBasicBlock::iterator` -- it's a `MachineInstr*` --
so `std::next(I)` would just point at some other arbitrary memory
allocation.
I just committed r249852 to maybe make it more clear.
> On 2015-Oct-09, at 00:40, James Molloy <james at jamesmolloy.co.uk> wrote:
>
> Hi Duncan,
>
> Why not use std::next(I) here?
>
> Cheers,
>
> James
>
> On Thu, 8 Oct 2015 at 23:45 Duncan P. N. Exon Smith via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 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;
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list