[PATCH] D66467: [Codegen] skip debug instr to avoid code change
Bjorn Pettersson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 7 07:32:28 PST 2019
bjope added a comment.
Here is an test case that currently fail. The test1, test2 and test3 functions only differ by DBG_VALUE and CFI_INSTRUCTION instructions. So I guess we want to see the same real instructions being generated for all three functions.
# RUN: llc -mtriple=x86_64-- -run-pass branch-folder -O3 -o - %s | FileCheck %s
---
name: test1
body: |
bb.0:
TEST8rr killed renamable $al, renamable $al, implicit-def $eflags
JCC_1 %bb.2, 5, implicit killed $eflags
bb.1:
MOV8mi $r12, 1, $noreg, 0, $noreg, 0
MOV8mi $r13, 1, $noreg, 0, $noreg, 0
RET 0
bb.2:
MOV8mi $r13, 1, $noreg, 0, $noreg, 0
RET 0
...
# CHECK-LABEL: name: test1
# CHECK: bb.0:
# CHECK: TEST8rr
# CHECK: JCC_1
# CHECK: bb.1:
# CHECK: successors: %bb.2
# CHECK: MOV8mi $r12
# CHECK: bb.2:
# CHECK: MOV8mi $r13
# CHECK: RET 0
---
name: test2
body: |
bb.0:
TEST8rr killed renamable $al, renamable $al, implicit-def $eflags
JCC_1 %bb.2, 5, implicit killed $eflags
bb.1:
MOV8mi $r12, 1, $noreg, 0, $noreg, 0
MOV8mi $r13, 1, $noreg, 0, $noreg, 0
CFI_INSTRUCTION def_cfa_offset 8
RET 0
bb.2:
DBG_VALUE
DBG_VALUE
CFI_INSTRUCTION def_cfa_offset 8
MOV8mi $r13, 1, $noreg, 0, $noreg, 0
RET 0
...
# CHECK-LABEL: name: test2
# CHECK: bb.0:
# CHECK: TEST8rr
# CHECK: JCC_1
# CHECK: bb.1:
# CHECK: successors: %bb.2
# CHECK: MOV8mi $r12
# CHECK: bb.2:
# CHECK: MOV8mi $r13
# CHECK: RET 0
---
name: test3
body: |
bb.0:
TEST8rr killed renamable $al, renamable $al, implicit-def $eflags
JCC_1 %bb.1, 5, implicit killed $eflags
bb.1:
MOV8mi $r12, 1, $noreg, 0, $noreg, 0
DBG_VALUE
CFI_INSTRUCTION def_cfa_offset 8
MOV8mi $r13, 1, $noreg, 0, $noreg, 0
CFI_INSTRUCTION offset $r13, -123
RET 0
bb.2:
DBG_VALUE
CFI_INSTRUCTION def_cfa_offset 8
DBG_VALUE
MOV8mi $r13, 1, $noreg, 0, $noreg, 0
DBG_VALUE
CFI_INSTRUCTION offset $r13, -123
DBG_VALUE
RET 0
...
# CHECK-LABEL: name: test3
# CHECK: bb.0:
# CHECK: TEST8rr
# CHECK: JCC_1
# CHECK: bb.1:
# CHECK: successors: %bb.2
# CHECK: MOV8mi $r12
# CHECK: bb.2:
# CHECK: MOV8mi $r13
# CHECK: RET 0
But we now get these three different functions:
name: test1
bb.0:
successors: %bb.2(0x40000000), %bb.1(0x40000000)
TEST8rr killed renamable $al, renamable $al, implicit-def $eflags
JCC_1 %bb.2, 5, implicit $eflags
bb.1:
successors: %bb.2(0x80000000)
MOV8mi $r12, 1, $noreg, 0, $noreg, 0
bb.2:
MOV8mi $r13, 1, $noreg, 0, $noreg, 0
RET 0
name: test2
bb.0:
successors: %bb.2(0x40000000), %bb.1(0x40000000)
TEST8rr killed renamable $al, renamable $al, implicit-def $eflags
JCC_1 %bb.2, 5, implicit killed $eflags
bb.1:
MOV8mi $r12, 1, $noreg, 0, $noreg, 0
MOV8mi $r13, 1, $noreg, 0, $noreg, 0
CFI_INSTRUCTION def_cfa_offset 8
RET 0
bb.2:
DBG_VALUE
DBG_VALUE
CFI_INSTRUCTION def_cfa_offset 8
MOV8mi $r13, 1, $noreg, 0, $noreg, 0
RET 0
name: test3
bb.0:
TEST8rr killed renamable $al, renamable $al, implicit-def $eflags
MOV8mi $r12, 1, $noreg, 0, $noreg, 0
DBG_VALUE
CFI_INSTRUCTION def_cfa_offset 8
MOV8mi $r13, 1, $noreg, 0, $noreg, 0
CFI_INSTRUCTION offset $r13, -123
RET 0
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66467/new/
https://reviews.llvm.org/D66467
More information about the llvm-commits
mailing list