mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-10 22:46:25 +00:00
[MemorySSA] Fix windows build breakage caused by r278028
r278028: [MemorySSA] Ensure address stability of MemorySSA object. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278035 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c97b57bee4
commit
555c63f414
@ -675,7 +675,14 @@ class MemorySSAAnalysis : public AnalysisInfoMixin<MemorySSAAnalysis> {
|
||||
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);
|
||||
};
|
||||
|
@ -2078,24 +2078,24 @@ bool MemorySSAPrinterLegacyPass::runOnFunction(Function &F) {
|
||||
|
||||
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();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user