[PATCH] D106881: [WIP][GIlobalSel] Add GISelCSEAnalysisWrapperPass::verifyAnalysis

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 27 08:41:51 PDT 2021


foad created this revision.
Herald added subscribers: hiraditya, tpr.
foad requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This enables automatic pass manager verification of the CSE analysis
after every pass that claims to preserve it.

TODO: avoid the ugly const_cast by rewriting GISelCSEInfo::verify() to
work in a const-friendly way?

TODO: fix the AMDGPU lit test failures


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106881

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CSEInfo.h
  llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp


Index: llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp
+++ llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp
@@ -430,6 +430,9 @@
   }
   return Info;
 }
+
+void GISelCSEAnalysisWrapper::verify() { cantFail(Info.verify()); }
+
 void GISelCSEAnalysisWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.setPreservesAll();
   MachineFunctionPass::getAnalysisUsage(AU);
Index: llvm/include/llvm/CodeGen/GlobalISel/CSEInfo.h
===================================================================
--- llvm/include/llvm/CodeGen/GlobalISel/CSEInfo.h
+++ llvm/include/llvm/CodeGen/GlobalISel/CSEInfo.h
@@ -214,6 +214,7 @@
   void setMF(MachineFunction &MFunc) { MF = &MFunc; }
   void setComputed(bool Computed) { AlreadyComputed = Computed; }
   void releaseMemory() { Info.releaseMemory(); }
+  void verify();
 };
 
 /// The actual analysis pass wrapper.
@@ -235,6 +236,10 @@
     Wrapper.releaseMemory();
     Wrapper.setComputed(false);
   }
+
+  void verifyAnalysis() const override {
+    const_cast<GISelCSEAnalysisWrapper *>(&Wrapper)->verify();
+  }
 };
 
 } // namespace llvm


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106881.362042.patch
Type: text/x-patch
Size: 1178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210727/ae260b51/attachment.bin>


More information about the llvm-commits mailing list