Address review feedbacks of AddDiscriminator change

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272850 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Xinliang David Li 2016-06-15 22:20:56 +00:00
parent 1e8c62127b
commit ac1a58e7e9
2 changed files with 7 additions and 6 deletions

View File

@ -20,11 +20,10 @@
namespace llvm {
/// Converts loops into loop-closed SSA form.
class AddDiscriminatorsPass : public PassInfoMixin<AddDiscriminatorsPass> {
public:
PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
};
} // end namespace llvm
#endif // LLVM_TRANSFORMS_UTILS_LCSSA_H
#endif // LLVM_TRANSFORMS_UTILS_ADDDISCRIMINATORS_H

View File

@ -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<Function> &AM) {
addDiscriminators(F);
// Only modifies debug info.
return PreservedAnalyses::all();
if (!addDiscriminators(F))
return PreservedAnalyses::all();
// FIXME: should be all()
return PreservedAnalyses::none();
}