[llvm] [CodeGen][Tablegen] Fix uninitialized var and shift overflow. (PR #84896)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 01:18:35 PDT 2024


================
@@ -935,7 +935,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
       unsigned Shift = 0;
       do {
         OS << ", " << (unsigned)*I;
-        Value += (*I & 0x7f) << Shift;
+        Value += ((uint64_t)(*I & 0x7f)) << Shift;
----------------
phoebewang wrote:

Sorry, I think the (uint64_t) in needed, because `Value` is uint64_t and `Shift` may larger than 32.

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


More information about the llvm-commits mailing list