[PATCH] D105983: [PredicateInfo] return true when the function was modified

Jeroen Dobbelaere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 14 07:37:14 PDT 2021


jeroen.dobbelaere created this revision.
jeroen.dobbelaere added reviewers: jroelofs, fhahn, nikic.
Herald added a subscriber: hiraditya.
jeroen.dobbelaere requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The PredicateInfo dumper potentially modifies the function it is analyzing. When that is the case it should report so and return true.

This fixes a bug that shows up with the old pass manager and EXPENSIVE_CHECKS. It was reported In D91661#2875179 <https://reviews.llvm.org/D91661#2875179> by @jroelofs


https://reviews.llvm.org/D105983

Files:
  llvm/include/llvm/Transforms/Utils/PredicateInfo.h
  llvm/lib/Transforms/Utils/PredicateInfo.cpp


Index: llvm/lib/Transforms/Utils/PredicateInfo.cpp
===================================================================
--- llvm/lib/Transforms/Utils/PredicateInfo.cpp
+++ llvm/lib/Transforms/Utils/PredicateInfo.cpp
@@ -834,7 +834,7 @@
   PredInfo->print(dbgs());
   if (VerifyPredicateInfo)
     PredInfo->verifyPredicateInfo();
-  return false;
+  return PredInfo->modifiedFunction();
 }
 
 PreservedAnalyses PredicateInfoPrinterPass::run(Function &F,
Index: llvm/include/llvm/Transforms/Utils/PredicateInfo.h
===================================================================
--- llvm/include/llvm/Transforms/Utils/PredicateInfo.h
+++ llvm/include/llvm/Transforms/Utils/PredicateInfo.h
@@ -187,6 +187,10 @@
     return PredicateMap.lookup(V);
   }
 
+  // Items added to the PredicateMap correspond to llvm.ssa.copy calls added to
+  // the function.
+  bool modifiedFunction() const { return !PredicateMap.empty(); }
+
 protected:
   // Used by PredicateInfo annotater, dumpers, and wrapper pass.
   friend class PredicateInfoAnnotatedWriter;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105983.358596.patch
Type: text/x-patch
Size: 1047 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210714/15787c43/attachment.bin>


More information about the llvm-commits mailing list