[llvm] [DecoderEmitter] Support for DecodeOrder and `resolve-conflicts-try-all` (PR #157948)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 12 09:34:39 PDT 2025


================
@@ -1598,6 +1726,19 @@ void FilterChooser::doFilter() {
     return;
   }
 
+  // If we were unable to find a useful filter and there are multiple decode
+  // orders involved, split the candidates by decode order and create per decode
+  // order choosers.
+  if (hasMultipleDecodeOrders()) {
----------------
s-barannikov wrote:

findBestFilter has three calls to the same-named overload. If we want to resolve conflicts automatically, only the first call should remain. The other two are broken.
Consider these two encodings:
```
xy0 InstA
xyz InstB
```
The second call to findBestFilter will put InstA in FilteredIDs and InstB in VariableIDs. The VariableIDs only have a chance to match if FilteredIDs fail.

InstA could allow patterns 000 and 110,
InstB could allow patterns 010 and 100.

If the actual encoding is 010 or 100, the generated decoder will attempt to decode it as InstA and fail, not trying to decode it as InstB.


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


More information about the llvm-commits mailing list