[llvm] r337090 - [MachineOutliner] Check the last instruction from the sequence when updating liveness
Francis Visoiu Mistrih via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 14 02:40:01 PDT 2018
Author: thegameg
Date: Sat Jul 14 02:40:01 2018
New Revision: 337090
URL: http://llvm.org/viewvc/llvm-project?rev=337090&view=rev
Log:
[MachineOutliner] Check the last instruction from the sequence when updating liveness
The MachineOutliner was doing an std::for_each from the call (inserted
before the outlined sequence) to the iterator at the end of the
sequence.
std::for_each needs the iterator past the end, so the last instruction
was not taken into account when propagating the liveness information.
This fixes the machine verifier issue in machine-outliner-disubprogram.ll.
Differential Revision: https://reviews.llvm.org/D49295
Modified:
llvm/trunk/lib/CodeGen/MachineOutliner.cpp
llvm/trunk/test/CodeGen/X86/machine-outliner-disubprogram.ll
Modified: llvm/trunk/lib/CodeGen/MachineOutliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineOutliner.cpp?rev=337090&r1=337089&r2=337090&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineOutliner.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineOutliner.cpp Sat Jul 14 02:40:01 2018
@@ -1309,7 +1309,7 @@ bool MachineOutliner::outline(
// First inst in outlined range <-- Anything that's defined in this
// ... .. range has to be added as an implicit
// Last inst in outlined range <-- def to the call instruction.
- std::for_each(CallInst, EndIt, CopyDefs);
+ std::for_each(CallInst, std::next(EndIt), CopyDefs);
}
// Erase from the point after where the call was inserted up to, and
Modified: llvm/trunk/test/CodeGen/X86/machine-outliner-disubprogram.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/machine-outliner-disubprogram.ll?rev=337090&r1=337089&r2=337090&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/machine-outliner-disubprogram.ll (original)
+++ llvm/trunk/test/CodeGen/X86/machine-outliner-disubprogram.ll Sat Jul 14 02:40:01 2018
@@ -2,7 +2,7 @@
; that we correctly emit DISubprograms for those functions.
; Also make sure that the DISubprograms reference the generated unit.
; make sure that if there are two outlined functions in the program,
-; RUN: llc %s -enable-machine-outliner -mtriple=x86_64-apple-darwin -o /dev/null -print-after=machine-outliner
+; RUN: llc %s -verify-machineinstrs -enable-machine-outliner -mtriple=x86_64-apple-darwin -o /dev/null -print-after=machine-outliner
define void @f6() #0 !dbg !8 {
entry:
%dog = alloca i32, align 4
More information about the llvm-commits
mailing list