[Hexagon] Fix assert with packetizing IMPLICIT_DEF instructions
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 6 Apr 2018 18:19:22 +0000 (18:19 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 6 Apr 2018 18:19:22 +0000 (18:19 +0000)
The compiler is generating packet with the following instructions,
which causes an undefined register assert in the verifier.

  $r0 = IMPLICIT_DEF
  $r1 = IMPLICIT_DEF
  S2_storerd_io killed $r29, 0, killed %d0

The problem is that the packetizer is not saving the IMPLICIT_DEF
instructions, which are needed when checking if it is legal to
add the store instruction. The fix is to add the IMPLICIT_DEF
instructions to the CurrentPacketMIs structure.

Patch by Brendon Cahoon.

llvm-svn: 329439

llvm/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp

index f8cfa09..8c528b9 100644 (file)
@@ -1687,8 +1687,12 @@ HexagonPacketizerList::addToPacket(MachineInstr &MI) {
     PacketStalls = false;
   PacketStalls |= producesStall(MI);
 
-  if (MI.isImplicitDef())
+  if (MI.isImplicitDef()) {
+    // Add to the packet to allow subsequent instructions to be checked
+    // properly.
+    CurrentPacketMIs.push_back(&MI);
     return MII;
+  }
   assert(ResourceTracker->canReserveResources(MI));
 
   bool ExtMI = HII->isExtended(MI) || HII->isConstExtended(MI);