From 3ff92c7452de805d8a689845211e4c52aeae4769 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Mon, 6 Jun 2016 20:01:50 +0000 Subject: [PATCH] [PM] Preserve the correct set of analyses for GVN. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271934 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/GVN.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index ef9638b9aa0..c3fcbbffeba 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -594,7 +594,12 @@ PreservedAnalyses GVN::run(Function &F, AnalysisManager &AM) { auto &AA = AM.getResult(F); auto &MemDep = AM.getResult(F); bool Changed = runImpl(F, AC, DT, TLI, AA, &MemDep); - return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all(); + if (!Changed) + return PreservedAnalyses::all(); + PreservedAnalyses PA; + PA.preserve(); + PA.preserve(); + return PA; } LLVM_DUMP_METHOD