[llvm] [TableGen][DecoderEmitter] Fix decoder reading bytes past instruction (PR #154916)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 22 04:25:26 PDT 2025


================
@@ -475,8 +488,9 @@ class FilterChooser {
   // Vector of encodings to choose our filter.
   ArrayRef<InstructionEncoding> Encodings;
 
-  // Vector of encoding IDs for this filter chooser to work on.
-  ArrayRef<unsigned> EncodingIDs;
+  /// Encoding IDs for this filter chooser to work on.
+  /// Sorted by non-decreasing encoding width.
+  SmallVector<unsigned, 0> EncodingIDs;
----------------
jurahul wrote:

Can this sorting be done at the top-level when we construct the `EncodingIDsByHwMode` in `DecoderEmitter::constructor`? Then we don't need to sort again individually and can keep using the ArrayRef here?

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


More information about the llvm-commits mailing list