[llvm] r278035 - [MemorySSA] Fix windows build breakage caused by r278028
Geoff Berry via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 8 11:27:22 PDT 2016
Author: gberry
Date: Mon Aug 8 13:27:22 2016
New Revision: 278035
URL: http://llvm.org/viewvc/llvm-project?rev=278035&view=rev
Log:
[MemorySSA] Fix windows build breakage caused by r278028
r278028: [MemorySSA] Ensure address stability of MemorySSA object.
Modified:
llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h
llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp
Modified: llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h?rev=278035&r1=278034&r2=278035&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h Mon Aug 8 13:27:22 2016
@@ -675,7 +675,14 @@ class MemorySSAAnalysis : public Analysi
static char PassID;
public:
- typedef std::unique_ptr<MemorySSA> Result;
+ // Wrap MemorySSA result to ensure address stability of internal MemorySSA
+ // pointers after construction. Use a wrapper class instead of plain
+ // unique_ptr<MemorySSA> to avoid build breakage on MSVC.
+ struct Result {
+ Result(std::unique_ptr<MemorySSA> &&MSSA) : MSSA(std::move(MSSA)) {}
+ MemorySSA &getMSSA() { return *MSSA.get(); }
+ std::unique_ptr<MemorySSA> MSSA;
+ };
Result run(Function &F, AnalysisManager<Function> &AM);
};
Modified: llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp?rev=278035&r1=278034&r2=278035&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp Mon Aug 8 13:27:22 2016
@@ -2078,24 +2078,24 @@ bool MemorySSAPrinterLegacyPass::runOnFu
char MemorySSAAnalysis::PassID;
-std::unique_ptr<MemorySSA>
+MemorySSAAnalysis::Result
MemorySSAAnalysis::run(Function &F, AnalysisManager<Function> &AM) {
auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
auto &AA = AM.getResult<AAManager>(F);
- return make_unique<MemorySSA>(F, &AA, &DT);
+ return MemorySSAAnalysis::Result(make_unique<MemorySSA>(F, &AA, &DT));
}
PreservedAnalyses MemorySSAPrinterPass::run(Function &F,
FunctionAnalysisManager &AM) {
OS << "MemorySSA for function: " << F.getName() << "\n";
- AM.getResult<MemorySSAAnalysis>(F)->print(OS);
+ AM.getResult<MemorySSAAnalysis>(F).getMSSA().print(OS);
return PreservedAnalyses::all();
}
PreservedAnalyses MemorySSAVerifierPass::run(Function &F,
FunctionAnalysisManager &AM) {
- AM.getResult<MemorySSAAnalysis>(F)->verifyMemorySSA();
+ AM.getResult<MemorySSAAnalysis>(F).getMSSA().verifyMemorySSA();
return PreservedAnalyses::all();
}
More information about the llvm-commits
mailing list