[llvm] r358910 - Use const DebugLoc&

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 22 18:40:48 PDT 2019


Sorry, had to revert this in r358940.

On Mon, Apr 22, 2019 at 12:12 PM Matt Arsenault via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: arsenm
> Date: Mon Apr 22 12:14:27 2019
> New Revision: 358910
>
> URL: http://llvm.org/viewvc/llvm-project?rev=358910&view=rev
> Log:
> Use const DebugLoc&
>
> Modified:
>     llvm/trunk/lib/CodeGen/BranchRelaxation.cpp
>
> Modified: llvm/trunk/lib/CodeGen/BranchRelaxation.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchRelaxation.cpp?rev=358910&r1=358909&r2=358910&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/BranchRelaxation.cpp (original)
> +++ llvm/trunk/lib/CodeGen/BranchRelaxation.cpp Mon Apr 22 12:14:27 2019
> @@ -300,7 +300,7 @@ bool BranchRelaxation::isBlockInRange(
>  /// too far away to fit in its displacement field. It is converted to an
> inverse
>  /// conditional branch + an unconditional branch to the destination.
>  bool BranchRelaxation::fixupConditionalBranch(MachineInstr &MI) {
> -  DebugLoc DL = MI.getDebugLoc();
> +  const DebugLoc &DL = MI.getDebugLoc();
>

See my commit log in the revert -- these copies are in fact necessary to
avoid the debug location's metadata going away prior to its use.


>    MachineBasicBlock *MBB = MI.getParent();
>    MachineBasicBlock *TBB = nullptr, *FBB = nullptr;
>    MachineBasicBlock *NewBB = nullptr;
> @@ -468,7 +468,7 @@ bool BranchRelaxation::fixupUnconditiona
>      MBB->replaceSuccessor(DestBB, BranchBB);
>    }
>
> -  DebugLoc DL = MI.getDebugLoc();
> +  const DebugLoc &DL = MI.getDebugLoc();
>    MI.eraseFromParent();
>    BlockInfo[BranchBB->getNumber()].Size += TII->insertIndirectBranch(
>      *BranchBB, *DestBB, DL, DestOffset - SrcOffset, RS.get());
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://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/20190422/657eb395/attachment.html>


More information about the llvm-commits mailing list