[llvm] [PowerPC] Use INT64_MAX instead of LONG_MAX. (PR #208249)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 8 09:09:25 PDT 2026
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/208249
The value of LONG_MAX is dependent on the host environment used to build the compiler. For example X86-64 Windows has a different value than X86-64 Linux. Using LONG_MAX would give inconsistent results when cross compiling.
I wonder if the test added in #65559 is generating a warning on X86-64 Windows, but the CHECK-NOT doesn't fail because the warning would say 2147483647 instead of 4294967295.
>From 07cb5f3f64e574bf25e50359cd393eef5aea8c91 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Wed, 8 Jul 2026 08:55:26 -0700
Subject: [PATCH] [PowerPC] Use INT64_MAX instead of LONG_MAX.
The value of LONG_MAX is dependent on the host environment used
to build the compiler. Using LONG_MAX would give inconsistent
results when cross compiling.
---
llvm/lib/Target/PowerPC/PPCFrameLowering.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
index aae3e49f6c70b..f1c81dcf887d1 100644
--- a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
@@ -2810,9 +2810,9 @@ uint64_t PPCFrameLowering::getStackThreshold() const {
// when extending the stack and is positive when releasing the stack frame.
// To make `stux` and `add` paired, the absolute value of the number contained
// in the scratch register should be the same. Thus the maximum stack size
- // is (2^63)-1, i.e., LONG_MAX.
+ // is (2^63)-1, i.e., INT64_MAX.
if (Subtarget.isPPC64())
- return LONG_MAX;
+ return INT64_MAX;
return TargetFrameLowering::getStackThreshold();
}
More information about the llvm-commits
mailing list