[llvm-commits] [llvm] r82903 - /llvm/trunk/lib/Transforms/Scalar/LICM.cpp

Dan Gohman gohman at apple.com
Sun Sep 27 09:10:30 PDT 2009


Author: djg
Date: Sun Sep 27 11:10:30 2009
New Revision: 82903

URL: http://llvm.org/viewvc/llvm-project?rev=82903&view=rev
Log:
Grab an LLVM Context from an instruction that exists rather than one
that is deleted in some situations. This fixes a use-after-free.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LICM.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=82903&r1=82902&r2=82903&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Sun Sep 27 11:10:30 2009
@@ -593,7 +593,7 @@
     if (AI) {
       std::vector<AllocaInst*> Allocas;
       Allocas.push_back(AI);
-      PromoteMemToReg(Allocas, *DT, *DF, I.getContext(), CurAST);
+      PromoteMemToReg(Allocas, *DT, *DF, AI->getContext(), CurAST);
     }
   }
 }





More information about the llvm-commits mailing list