[PATCH] D111219: [MachineCopyPropagation] Handle propagation of undef copies
Carl Ritson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 6 03:49:21 PDT 2021
critson created this revision.
critson added reviewers: lkail, rampitec, jmorse, foad.
Herald added subscribers: kerbowa, hiraditya, nhaehnle, jvesely.
critson requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When propagating undefined copies the undef flag must also be
propagated.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111219
Files:
llvm/lib/CodeGen/MachineCopyPropagation.cpp
llvm/test/CodeGen/AMDGPU/undef-copy-propagation.mir
Index: llvm/test/CodeGen/AMDGPU/undef-copy-propagation.mir
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AMDGPU/undef-copy-propagation.mir
@@ -0,0 +1,22 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -o - %s -march=amdgcn -mcpu=gfx1010 -run-pass=machine-cp -verify-machineinstrs | FileCheck %s
+
+---
+name: undef_copy_propagation
+tracksRegLiveness: true
+body: |
+ bb.0:
+
+ ; CHECK-LABEL: name: undef_copy_propagation
+ ; CHECK: renamable $vgpr0 = COPY undef renamable $sgpr42, implicit $exec
+ ; CHECK-NEXT: renamable $vgpr1 = COPY undef $sgpr42
+ ; CHECK-NEXT: renamable $vgpr2 = COPY undef $sgpr42
+ ; CHECK-NEXT: renamable $vgpr3 = COPY undef $sgpr42
+ ; CHECK-NEXT: EXP_DONE 0, killed $vgpr0, killed $vgpr1, killed $vgpr2, killed $vgpr3, -1, -1, 15, implicit $exec
+ renamable $vgpr0 = COPY undef renamable $sgpr42, implicit $exec
+ renamable $vgpr1 = COPY renamable $vgpr0
+ renamable $vgpr2 = COPY renamable $vgpr0
+ renamable $vgpr3 = COPY renamable $vgpr0
+
+ EXP_DONE 0, killed $vgpr0, killed $vgpr1, killed $vgpr2, killed $vgpr3, -1, -1, 15, implicit $exec
+...
Index: llvm/lib/CodeGen/MachineCopyPropagation.cpp
===================================================================
--- llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -576,6 +576,8 @@
MOUse.setReg(CopySrcReg);
if (!CopySrc.isRenamable())
MOUse.setIsRenamable(false);
+ if (CopySrc.isUndef())
+ MOUse.setIsUndef(true);
LLVM_DEBUG(dbgs() << "MCP: After replacement: " << MI << "\n");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111219.377493.patch
Type: text/x-patch
Size: 1685 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211006/bc5894c0/attachment.bin>
More information about the llvm-commits
mailing list