From e46e5193452d612a9dea05cf4ab98c2a7125d270 Mon Sep 17 00:00:00 2001 From: Martin Bohme Date: Wed, 25 Jan 2017 14:28:19 +0000 Subject: [PATCH] [ARM] GlobalISel: Fix stack-use-after-scope bug. Summary: Lifetime extension wasn't triggered on the result of BuildMI because the reference was non-const. However, instead of adding a const, I've removed the reference entirely as RVO should kick in anyway. Reviewers: rovka, bkramer Reviewed By: bkramer Subscribers: aemerson, rengolin, dberris, llvm-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D29124 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293059 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMInstructionSelector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Target/ARM/ARMInstructionSelector.cpp b/lib/Target/ARM/ARMInstructionSelector.cpp index 5a4d6a874e6..4167344337d 100644 --- a/lib/Target/ARM/ARMInstructionSelector.cpp +++ b/lib/Target/ARM/ARMInstructionSelector.cpp @@ -132,7 +132,7 @@ bool ARMInstructionSelector::select(MachineInstr &I) const { I.getOperand(0).setReg(AndResult); auto InsertBefore = std::next(I.getIterator()); - auto &SubI = + auto SubI = BuildMI(MBB, InsertBefore, I.getDebugLoc(), TII.get(ARM::RSBri)) .addDef(SExtResult) .addUse(AndResult) -- 2.11.0