From: Dan Gohman Date: Sun, 27 Sep 2009 16:10:30 +0000 (+0000) Subject: Grab an LLVM Context from an instruction that exists rather than one X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f37cfed7911971e0326ed0b2de526bcc26c92950;p=oota-llvm.git 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 --- 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); } } }