]> granicus.if.org Git - llvm/commitdiff
[ARM] GlobalISel: Fix stack-use-after-scope bug.
authorMartin Bohme <mboehme@google.com>
Wed, 25 Jan 2017 14:28:19 +0000 (14:28 +0000)
committerMartin Bohme <mboehme@google.com>
Wed, 25 Jan 2017 14:28:19 +0000 (14:28 +0000)
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

index 5a4d6a874e6bacc26db8b123b2f446d779c4b553..4167344337d4216916d5d53b2d29c646347f414a 100644 (file)
@@ -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)