Files
clang-p2996/llvm/test/CodeGen/AArch64/expand-subs-pseudo.mir
Andrew Wei da9ed3dc71 [AArch64] Avoid adding duplicate implicit operands when expanding pseudo insts.
When expanding pseudo insts, in order to create a new machine instr, we use BuildMI,
which will add implicit operands by default. And transferImpOps will also copy implicit
operands from old ones. Finally, duplicate implicit operands are added to the same inst.
Sometimes this can cause correctness issues. Like below inst,
    renamable $w18 = nsw SUBSWrr renamable $w30, renamable $w14, implicit-def dead $nzcv
After expanding, it will become
    $w18 = SUBSWrs renamable $w13, renamable $w14, 0, implicit-def $nzcv, implicit-def dead $nzcv
A redundant implicit-def $nzcv is added, but the dead flag is missing.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D109069
2021-09-07 17:11:58 +08:00

22 lines
677 B
YAML

# RUN: llc -run-pass=aarch64-expand-pseudo -mtriple=aarch64-unknown-linux-gnu -o - %s | FileCheck %s
---
# CHECK-LABEL: name: test
# CHECK-LABEL: bb.0:
# CHECK: $w5 = SUBSWrs renamable $w3, renamable $w2, 0, implicit-def dead $nzcv
# CHECK-NEXT: $w6 = SUBSWrs renamable $w5, renamable $w3, 0, implicit-def $nzcv
# CHECK-NEXT: RET undef $lr
#
name: test
alignment: 4
tracksRegLiveness: true
body: |
bb.0:
liveins: $w5, $w6, $x2, $x3
renamable $w5 = nsw SUBSWrr renamable $w3, renamable $w2, implicit-def dead $nzcv
renamable $w6 = nsw SUBSWrr renamable $w5, renamable $w3, implicit-def $nzcv
RET_ReallyLR
...