diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2019-04-23 01:42:07 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2019-04-23 01:42:07 +0000 |
commit | bbddf21f900a868072710fbc8b424cc387a390aa (patch) | |
tree | fccff7971b03a544965ca2247a71db5c5066fddf /llvm/lib/CodeGen/BranchRelaxation.cpp | |
parent | 759805fd8a6c301b43a89a74700b750d19ba5f9a (diff) | |
download | bcm5719-llvm-bbddf21f900a868072710fbc8b424cc387a390aa.tar.gz bcm5719-llvm-bbddf21f900a868072710fbc8b424cc387a390aa.zip |
Revert "Use const DebugLoc&"
This reverts r358910 (git commit 2b744665308fc8d30a3baecb4947f2bd81aa7d30)
While this patch *seems* trivial and safe and correct, it is not. The
copies are actually load bearing copies. You can observe this with MSan
or other ways of checking for use-after-destroy, but otherwise this may
result in ... difficult to debug inexplicable behavior.
I suspect the issue is that the debug location is used after the
original reference to it is removed. The metadata backing it gets
destroyed as its last references goes away, and then we reference it
later through these const references.
llvm-svn: 358940
Diffstat (limited to 'llvm/lib/CodeGen/BranchRelaxation.cpp')
-rw-r--r-- | llvm/lib/CodeGen/BranchRelaxation.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/BranchRelaxation.cpp b/llvm/lib/CodeGen/BranchRelaxation.cpp index 15edc98c47f..3ad6266d4f3 100644 --- a/llvm/lib/CodeGen/BranchRelaxation.cpp +++ b/llvm/lib/CodeGen/BranchRelaxation.cpp @@ -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) { - const DebugLoc &DL = MI.getDebugLoc(); + DebugLoc DL = MI.getDebugLoc(); MachineBasicBlock *MBB = MI.getParent(); MachineBasicBlock *TBB = nullptr, *FBB = nullptr; MachineBasicBlock *NewBB = nullptr; @@ -468,7 +468,7 @@ bool BranchRelaxation::fixupUnconditionalBranch(MachineInstr &MI) { MBB->replaceSuccessor(DestBB, BranchBB); } - const DebugLoc &DL = MI.getDebugLoc(); + DebugLoc DL = MI.getDebugLoc(); MI.eraseFromParent(); BlockInfo[BranchBB->getNumber()].Size += TII->insertIndirectBranch( *BranchBB, *DestBB, DL, DestOffset - SrcOffset, RS.get()); |