[Hexagon] Fixing leak in padEndloop by allocating in MCContext.
authorColin LeMahieu <colinl@codeaurora.org>
Fri, 13 Nov 2015 07:58:06 +0000 (07:58 +0000)
committerColin LeMahieu <colinl@codeaurora.org>
Fri, 13 Nov 2015 07:58:06 +0000 (07:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253019 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Hexagon/HexagonAsmPrinter.cpp
lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp
lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp
lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.h

index b5e423ef2b4fa6c2dd14c525ea77d1ecb3c9a827..1ce5df1e89bf30ac6ac4b76b858ff8cd9cf3a5fa 100644 (file)
@@ -198,7 +198,7 @@ void HexagonAsmPrinter::EmitInstruction(const MachineInstr *MI) {
   }
   else {
     HexagonLowerToMC(MI, MCB, *this);
-    HexagonMCInstrInfo::padEndloop(MCB);
+    HexagonMCInstrInfo::padEndloop(OutStreamer->getContext(), MCB);
   }
   // Examine the packet and try to find instructions that can be converted
   // to compounds.
index 1b09a36960d883d1e8560597364391b8d68fc1ea..ddedbdbf00484968a5963d614b40bad0101eff05 100644 (file)
@@ -50,7 +50,7 @@ void HexagonMCELFStreamer::EmitInstruction(const MCInst &MCK,
 
   // Examines packet and pad the packet, if needed, when an
   // end-loop is in the bundle.
-  HexagonMCInstrInfo::padEndloop(*MCB);
+  HexagonMCInstrInfo::padEndloop(getContext(), *MCB);
   HexagonMCShuffle(*MCII, STI, *MCB);
 
   assert(HexagonMCInstrInfo::bundleSize(*MCB) <= HEXAGON_PACKET_SIZE);
index 2145fb7f4234501fc9551f17c4017efbcd623d8b..3af1e14319ee0c8b2074fc1ac32c4c36ecbe4f64 100644 (file)
@@ -79,7 +79,7 @@ bool HexagonMCInstrInfo::canonicalizePacket(MCInstrInfo const &MCII,
   }
   // Examines packet and pad the packet, if needed, when an
   // end-loop is in the bundle.
-  HexagonMCInstrInfo::padEndloop(MCB);
+  HexagonMCInstrInfo::padEndloop(Context, MCB);
   // If compounding and duplexing didn't reduce the size below
   // 4 or less we have a packet that is too big.
   if (HexagonMCInstrInfo::bundleSize(MCB) > HEXAGON_PACKET_SIZE)
@@ -569,7 +569,7 @@ int64_t HexagonMCInstrInfo::minConstant(MCInst const &MCI, size_t Index) {
   return Value;
 }
 
-void HexagonMCInstrInfo::padEndloop(MCInst &MCB) {
+void HexagonMCInstrInfo::padEndloop(MCContext &Context, MCInst &MCB) {
   MCInst Nop;
   Nop.setOpcode(Hexagon::A2_nop);
   assert(isBundle(MCB));
@@ -577,7 +577,7 @@ void HexagonMCInstrInfo::padEndloop(MCInst &MCB) {
           (HexagonMCInstrInfo::bundleSize(MCB) < HEXAGON_PACKET_INNER_SIZE)) ||
          ((HexagonMCInstrInfo::isOuterLoop(MCB) &&
            (HexagonMCInstrInfo::bundleSize(MCB) < HEXAGON_PACKET_OUTER_SIZE))))
-    MCB.addOperand(MCOperand::createInst(new MCInst(Nop)));
+    MCB.addOperand(MCOperand::createInst(new (Context) MCInst(Nop)));
 }
 
 bool HexagonMCInstrInfo::prefersSlot3(MCInstrInfo const &MCII,
index f8c6f395ee10743e41bbdededb5eeaf09e6ec187..81dd874b7df7d65e5d70b23db7d7e93deb67bf9b 100644 (file)
@@ -261,7 +261,7 @@ bool isSoloAin1(MCInstrInfo const &MCII, MCInst const &MCI);
 bool isVector(MCInstrInfo const &MCII, MCInst const &MCI);
 
 // Pad the bundle with nops to satisfy endloop requirements
-void padEndloop(MCInst &MCI);
+void padEndloop(MCContext &Context, MCInst &MCI);
 
 bool prefersSlot3(MCInstrInfo const &MCII, MCInst const &MCI);