[llvm] [GlobalISel] Refactor Combiner MatchData & Apply C++ Code Handling (PR #92239)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 09:49:17 PDT 2024


================
@@ -1175,9 +1180,20 @@ bool CombineRuleBuilder::checkSemantics() {
     UsesWipMatchOpcode = true;
   }
 
+  std::optional<bool> IsUsingCXXPatterns;
   for (const auto &Apply : ApplyPats) {
-    assert(Apply.second.get());
-    const auto *IP = dyn_cast<InstructionPattern>(Apply.second.get());
+    Pattern *Pat = Apply.second.get();
+    if (IsUsingCXXPatterns) {
+      if (*IsUsingCXXPatterns != isa<CXXPattern>(Pat)) {
+        PrintError("'apply' patterns cannot mix C++ code with other types of "
----------------
arsenm wrote:

Probably should note this in the documentation 

https://github.com/llvm/llvm-project/pull/92239


More information about the llvm-commits mailing list