llvm.org GIT mirror llvm / 3e86d1d
[CodeGen] Skip over dbg-instr in twoaddr pass A DBG_VALUE between a two-address instruction and a following COPY would prevent rescheduleMIBelowKill optimization inside TwoAddressInstructionPass. Differential Revision: https://reviews.llvm.org/D55987 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350289 91177308-0d34-0410-b5e6-96231b3b80d8 Markus Lavin 8 months ago
2 changed file(s) with 33 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
928928 MachineBasicBlock::iterator Begin = MI;
929929 MachineBasicBlock::iterator AfterMI = std::next(Begin);
930930 MachineBasicBlock::iterator End = AfterMI;
931 while (End->isCopy() &&
932 regOverlapsSet(Defs, End->getOperand(1).getReg(), TRI)) {
933 Defs.push_back(End->getOperand(0).getReg());
931 while (End != MBB->end()) {
932 End = skipDebugInstructionsForward(End, MBB->end());
933 if (End->isCopy() && regOverlapsSet(Defs, End->getOperand(1).getReg(), TRI))
934 Defs.push_back(End->getOperand(0).getReg());
935 else
936 break;
934937 ++End;
935938 }
936939
0 # RUN: llc -run-pass=livevars,twoaddressinstruction -mtriple=x86_64-- -o - %s | FileCheck %s
1 ---
2 name: foo
3 tracksRegLiveness: true
4 body: |
5 bb.0:
6 liveins: $edi
7
8 %0:gr32 = COPY killed $edi
9 %1:gr32 = COPY killed %0
10 %4:gr32 = XOR32ri8 %1, 1, implicit-def dead $eflags
11 DBG_VALUE %4
12 %5:gr32 = COPY %4
13 PUSH32r killed %1, implicit-def $esp, implicit $esp
14 $eax = COPY killed %5
15 RETQ implicit killed $eax
16
17 ...
18
19 # Verify that the DBG_VALUE instruction does not inhibit
20 # TwoAddressInstructionPass::rescheduleMIBelowKill optimization
21
22 # CHECK: PUSH32r %1, implicit-def $esp, implicit $esp
23 # CHECK-NEXT: %2:gr32 = COPY killed %1
24 # CHECK-NEXT: %2:gr32 = XOR32ri8 %2, 1, implicit-def dead $eflags
25 # CHECK-NEXT: DBG_VALUE %2
26 # CHECK-NEXT: %3:gr32 = COPY killed %2