From f37cfed7911971e0326ed0b2de526bcc26c92950 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Sun, 27 Sep 2009 16:10:30 +0000 Subject: [PATCH] Grab an LLVM Context from an instruction that exists rather than one that is deleted in some situations. This fixes a use-after-free. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82903 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LICM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index fe37ab4caa1..6df246fa80e 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -593,7 +593,7 @@ void LICM::sink(Instruction &I) { if (AI) { std::vector Allocas; Allocas.push_back(AI); - PromoteMemToReg(Allocas, *DT, *DF, I.getContext(), CurAST); + PromoteMemToReg(Allocas, *DT, *DF, AI->getContext(), CurAST); } } }