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

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 9 00:40:02 PDT 2015


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151009/60699b3f/attachment.html>


More information about the llvm-commits mailing list