aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-09-27 16:10:30 +0000
committerDan Gohman <gohman@apple.com>2009-09-27 16:10:30 +0000
commit791c8251355c2f25f39685a7deab22560793c6fa (patch)
tree597dd061a94691997ef80ad5d7f2ad09313198e2
parentfecf86a40e1d27384518d37c51470352b7c5bd91 (diff)
downloadexternal_llvm-791c8251355c2f25f39685a7deab22560793c6fa.zip
external_llvm-791c8251355c2f25f39685a7deab22560793c6fa.tar.gz
external_llvm-791c8251355c2f25f39685a7deab22560793c6fa.tar.bz2
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
-rw-r--r--lib/Transforms/Scalar/LICM.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index fe37ab4..6df246f 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<AllocaInst*> Allocas;
Allocas.push_back(AI);
- PromoteMemToReg(Allocas, *DT, *DF, I.getContext(), CurAST);
+ PromoteMemToReg(Allocas, *DT, *DF, AI->getContext(), CurAST);
}
}
}