[llvm] [TableGen] Validate the shift amount for !srl, !shl, and !sra operators. (PR #132492)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 11:12:59 PDT 2025


================
@@ -1556,7 +1562,7 @@ const Init *BinOpInit::Fold(const Record *CurRec) const {
       case OR:  Result = LHSv | RHSv; break;
       case XOR: Result = LHSv ^ RHSv; break;
       case SHL: Result = (uint64_t)LHSv << (uint64_t)RHSv; break;
-      case SRA: Result = LHSv >> RHSv; break;
+      case SRA: Result = LHSv >> (uint64_t)RHSv; break;
----------------
preames wrote:

This change should be a nop given the newly added bounds check, right?

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


More information about the llvm-commits mailing list