llvm/test/CodeGen/AArch64/regcoal-constreg.mir
Matthias Braun 2821987cf3 RegisterCoalescer: Ignore interferences for constant physregs
When copying to/from a constant register interferences can be ignored.

Also update the documentation for isConstantPhysReg() to make it more
obvious that this transformation is valid.

Differential Revision: https://reviews.llvm.org/D26106

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286503 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-10 21:22:47 +00:00

32 lines
768 B
YAML

# RUN: llc -mtriple=aarch64-- -run-pass=simple-register-coalescing %s -o - | FileCheck %s
--- |
define void @func() { ret void }
...
---
# Check that we eliminate copies to/from constant physregs regardless of
# "interfering" reads/writes.
# CHECK: name: func
# CHECK-NOT: COPY
# CHECK: STRWui %wzr, %x1
# CHECK-NOT: COPY
# CHECK: STRXui %xzr, %x1
# CHECK: %wzr = SUBSWri %w1, 0, 0
name: func
registers:
- { id: 0, class: gpr32 }
- { id: 1, class: gpr64 }
- { id: 2, class: gpr32 }
body: |
bb.0:
%0 = COPY %wzr
dead %wzr = SUBSWri %w1, 0, 0, implicit-def %nzcv
STRWui %0, %x1, 0
%1 = COPY %xzr
dead %wzr = SUBSWri %w1, 0, 0, implicit-def %nzcv
STRXui %1, %x1, 0
%2 = SUBSWri %w1, 0, 0, implicit-def %nzcv
%wzr = COPY %2
...