summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/MIR
diff options
context:
space:
mode:
authorJun Bum Lim <junbuml@codeaurora.org>2016-03-25 21:15:35 +0000
committerJun Bum Lim <junbuml@codeaurora.org>2016-03-25 21:15:35 +0000
commit36c53fe147378109ddebed3d3f62fafcccca105a (patch)
treeee0471296dbccf4b5ca314cd061447127892baf0 /llvm/test/CodeGen/MIR
parentfa250cad3715a5df114cc5916e3b6f70560f9116 (diff)
downloadbcm5719-llvm-36c53fe147378109ddebed3d3f62fafcccca105a.tar.gz
bcm5719-llvm-36c53fe147378109ddebed3d3f62fafcccca105a.zip
[MachineCopyPropagation] Expose more dead copies across instructions with regmasks
When encountering instructions with regmasks, instead of cleaning up all the elements in MaybeDeadCopies map, remove only the instructions erased. By keeping more instruction in MaybeDeadCopies, this change will expose more dead copies across instructions with regmasks. llvm-svn: 264462
Diffstat (limited to 'llvm/test/CodeGen/MIR')
-rw-r--r--llvm/test/CodeGen/MIR/AArch64/machine-dead-copy.mir67
1 files changed, 67 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/MIR/AArch64/machine-dead-copy.mir b/llvm/test/CodeGen/MIR/AArch64/machine-dead-copy.mir
new file mode 100644
index 00000000000..1257948436c
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/AArch64/machine-dead-copy.mir
@@ -0,0 +1,67 @@
+
+# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass machine-cp -verify-machineinstrs -o /dev/null %s 2>&1 | FileCheck %s
+
+--- |
+ define i32 @copyprop1(i32 %a, i32 %b) { ret i32 %a }
+ define i32 @copyprop2(i32 %a, i32 %b) { ret i32 %a }
+ define i32 @copyprop3(i32 %a, i32 %b) { ret i32 %a }
+ define i32 @copyprop4(i32 %a, i32 %b) { ret i32 %a }
+ declare i32 @foo(i32)
+...
+---
+# The first copy is dead copy which is not used.
+# CHECK-LABEL: name: copyprop1
+# CHECK: bb.0:
+# CHECK-NOT: %w20 = COPY
+name: copyprop1
+body: |
+ bb.0:
+ liveins: %w0, %w1
+ %w20 = COPY %w1
+ BL @foo, csr_aarch64_aapcs, implicit %w0, implicit-def %w0
+ RET_ReallyLR implicit %w0
+...
+---
+# The first copy is not a dead copy which is used in the second copy after the
+# call.
+# CHECK-LABEL: name: copyprop2
+# CHECK: bb.0:
+# CHECK: %w20 = COPY
+name: copyprop2
+body: |
+ bb.0:
+ liveins: %w0, %w1
+ %w20 = COPY %w1
+ BL @foo, csr_aarch64_aapcs, implicit %w0, implicit-def %w0
+ %w0 = COPY %w20
+ RET_ReallyLR implicit %w0
+...
+---
+# Both the first and second copy are dead copies which are not used.
+# CHECK-LABEL: name: copyprop3
+# CHECK: bb.0:
+# CHECK-NOT: COPY
+name: copyprop3
+body: |
+ bb.0:
+ liveins: %w0, %w1
+ %w20 = COPY %w1
+ BL @foo, csr_aarch64_aapcs, implicit %w0, implicit-def %w0
+ %w20 = COPY %w0
+ RET_ReallyLR implicit %w0
+...
+# The second copy is removed as a NOP copy, after then the first copy become
+# dead which should be removed as well.
+# CHECK-LABEL: name: copyprop4
+# CHECK: bb.0:
+# CHECK-NOT: COPY
+name: copyprop4
+body: |
+ bb.0:
+ liveins: %w0, %w1
+ %w20 = COPY %w0
+ %w0 = COPY %w20
+ BL @foo, csr_aarch64_aapcs, implicit %w0, implicit-def %w0
+ RET_ReallyLR implicit %w0
+...
+
OpenPOWER on IntegriCloud