[llvm] Fix memory leak in LLVMTargetMachine.cpp (PR #109610)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 23 00:16:40 PDT 2024
https://github.com/abhishek-kaushik22 updated https://github.com/llvm/llvm-project/pull/109610
>From 586aa68f8b1cfc9805349320205575bfb8fab5da Mon Sep 17 00:00:00 2001
From: abhishek-kaushik22 <abhishek.kaushik at intel.com>
Date: Mon, 23 Sep 2024 11:12:45 +0530
Subject: [PATCH 1/2] Fix memory leak in LLVMTargetMachine.cpp
---
llvm/lib/CodeGen/LLVMTargetMachine.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index d0dfafeaef561f..f7335de116e1f7 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -259,9 +259,11 @@ bool LLVMTargetMachine::addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx,
const MCRegisterInfo &MRI = *getMCRegisterInfo();
std::unique_ptr<MCCodeEmitter> MCE(
getTarget().createMCCodeEmitter(*getMCInstrInfo(), *Ctx));
+ if (!MCE)
+ return true;
MCAsmBackend *MAB =
getTarget().createMCAsmBackend(STI, MRI, Options.MCOptions);
- if (!MCE || !MAB)
+ if (!MAB)
return true;
const Triple &T = getTargetTriple();
>From 2958b7b2bd86e190b2d0b5505e2c441f71309ff4 Mon Sep 17 00:00:00 2001
From: abhishek-kaushik22 <abhishek.kaushik at intel.com>
Date: Mon, 23 Sep 2024 11:18:37 +0530
Subject: [PATCH 2/2] format LLVMTargetMachine.cpp
---
llvm/lib/CodeGen/LLVMTargetMachine.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index f7335de116e1f7..4ff22057b290f5 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -260,7 +260,7 @@ bool LLVMTargetMachine::addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx,
std::unique_ptr<MCCodeEmitter> MCE(
getTarget().createMCCodeEmitter(*getMCInstrInfo(), *Ctx));
if (!MCE)
- return true;
+ return true;
MCAsmBackend *MAB =
getTarget().createMCAsmBackend(STI, MRI, Options.MCOptions);
if (!MAB)
More information about the llvm-commits
mailing list