[llvm] [AArch64] Check for negative numbers when adjusting icmps (PR #140999)

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed May 28 13:55:40 PDT 2025


================
@@ -3647,6 +3647,16 @@ static bool isLegalArithImmed(uint64_t C) {
   return IsLegal;
 }
 
+bool isLegalCmpImmed(int64_t Immed) {
+  if (Immed == std::numeric_limits<int64_t>::min()) {
+    LLVM_DEBUG(dbgs() << "Illegal add imm " << Immed
+                      << ": avoid UB for INT64_MIN\n");
----------------
davemgreen wrote:

This can be removed (we usually don't include debug in this kind of function). The version in isLegalAddImmediate can be removed too.

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


More information about the llvm-commits mailing list