From ac1a58e7e99d88b39b222710d601677557d3ef8b Mon Sep 17 00:00:00 2001 From: Xinliang David Li Date: Wed, 15 Jun 2016 22:20:56 +0000 Subject: [PATCH] Address review feedbacks of AddDiscriminator change git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272850 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Transforms/Utils/AddDiscriminators.h | 3 +-- lib/Transforms/Utils/AddDiscriminators.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/llvm/Transforms/Utils/AddDiscriminators.h b/include/llvm/Transforms/Utils/AddDiscriminators.h index 6096d21cb01..0b3a8add627 100644 --- a/include/llvm/Transforms/Utils/AddDiscriminators.h +++ b/include/llvm/Transforms/Utils/AddDiscriminators.h @@ -20,11 +20,10 @@ namespace llvm { -/// Converts loops into loop-closed SSA form. class AddDiscriminatorsPass : public PassInfoMixin { public: PreservedAnalyses run(Function &F, AnalysisManager &AM); }; } // end namespace llvm -#endif // LLVM_TRANSFORMS_UTILS_LCSSA_H +#endif // LLVM_TRANSFORMS_UTILS_ADDDISCRIMINATORS_H diff --git a/lib/Transforms/Utils/AddDiscriminators.cpp b/lib/Transforms/Utils/AddDiscriminators.cpp index baf65b628b6..d034905b657 100644 --- a/lib/Transforms/Utils/AddDiscriminators.cpp +++ b/lib/Transforms/Utils/AddDiscriminators.cpp @@ -155,7 +155,7 @@ FunctionPass *llvm::createAddDiscriminatorsPass() { /// lexical block for I2 and all the instruction in B2 that share the same /// file and line location as I2. This new lexical block will have a /// different discriminator number than I1. -bool addDiscriminators(Function &F) { +static bool addDiscriminators(Function &F) { // If the function has debug information, but the user has disabled // discriminators, do nothing. // Simlarly, if the function has no debug info, do nothing. @@ -250,7 +250,9 @@ bool AddDiscriminatorsLegacyPass::runOnFunction(Function &F) { } PreservedAnalyses AddDiscriminatorsPass::run(Function &F, AnalysisManager &AM) { - addDiscriminators(F); - // Only modifies debug info. - return PreservedAnalyses::all(); + if (!addDiscriminators(F)) + return PreservedAnalyses::all(); + + // FIXME: should be all() + return PreservedAnalyses::none(); }