[PATCH] D83034: [GlobalISel] Don't skip adding predicate matcher

Madhur Amilkanthwar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 2 04:15:47 PDT 2020


madhur13490 created this revision.
madhur13490 added reviewers: arsenm, nhaehnle, dsanders.
Herald added subscribers: llvm-commits, rovka, wdng.
Herald added a project: LLVM.
madhur13490 retitled this revision from "[GlobalISel] Don't skip adding predicate code" to "[GlobalISel] Don't skip adding predicate macther".
madhur13490 retitled this revision from "[GlobalISel] Don't skip adding predicate macther" to "[GlobalISel] Don't skip adding predicate matcher".

This patch fixes a bug which skipped 
adding predicate matcher for a pattern in many cases.
For example, if predicate is Load and
its memoryVT is non-null then the loop
continues and never reaches to the end which
adds the predicate matcher. This patch moves the 
matcher addition to the top of the loop
so that it gets added regardless of contextual checks
later in the loop.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83034

Files:
  llvm/utils/TableGen/GlobalISelEmitter.cpp


Index: llvm/utils/TableGen/GlobalISelEmitter.cpp
===================================================================
--- llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -3569,6 +3569,11 @@
       continue;
     }
 
+    if (Predicate.hasGISelPredicateCode()) {
+      InsnMatcher.addPredicate<GenericInstructionPredicateMatcher>(Predicate);
+      continue;
+    }
+
     // An address space check is needed in all contexts if there is one.
     if (Predicate.isLoad() || Predicate.isStore() || Predicate.isAtomic()) {
       if (const ListInit *AddrSpaces = Predicate.getAddressSpaces()) {
@@ -3705,12 +3710,6 @@
         continue;
       }
     }
-
-    if (Predicate.hasGISelPredicateCode()) {
-      InsnMatcher.addPredicate<GenericInstructionPredicateMatcher>(Predicate);
-      continue;
-    }
-
     return failedImport("Src pattern child has predicate (" +
                         explainPredicates(Src) + ")");
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83034.275054.patch
Type: text/x-patch
Size: 970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200702/140602c7/attachment-0001.bin>


More information about the llvm-commits mailing list