[PATCH] D62740: [MIR-Canon] Don't do vreg skip for independent instructions if there are none.

Puyan Lotfi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 09:22:57 PDT 2019

plotfi created this revision.
plotfi added reviewers: compnerd, bogner.
Herald added subscribers: llvm-commits, hiraditya, nhaehnle, jvesely.
Herald added a project: LLVM.

We don't want to create vregs if there is nothing to use them for. That causes verifier errors.

  rG LLVM Github Monorepo



Index: llvm/test/CodeGen/MIR/AMDGPU/parse-order-reserved-regs.mir
--- llvm/test/CodeGen/MIR/AMDGPU/parse-order-reserved-regs.mir
+++ llvm/test/CodeGen/MIR/AMDGPU/parse-order-reserved-regs.mir
@@ -1,4 +1,5 @@
 # RUN: llc -march=amdgcn -run-pass=none -verify-machineinstrs -o - %s | FileCheck %s
+# RUN: llc -march=amdgcn  -run-pass mir-canonicalizer -verify-machineinstrs -o - %s
 # Previously getReservedRegs was called before parsing
 # machineFunctionInfo, but the AMDGPU implementation depends on
Index: llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
--- llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
+++ llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
@@ -743,7 +743,8 @@
   // of the MachineBasicBlock so that they are named in the order that we sorted
   // them alphabetically. Eventually we wont need SkipVRegs because we will use
   // named vregs instead.
-  NVC.SkipVRegs();
+  if (IdempotentInstCount)
+    NVC.SkipVRegs();
   auto MII = MBB->begin();
   for (unsigned i = 0; i < IdempotentInstCount && MII != MBB->end(); ++i) {

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62740.202451.patch
Type: text/x-patch
Size: 1166 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190531/f0152dad/attachment.bin>

More information about the llvm-commits mailing list