[clang] [llvm] [Clang][BPF] Allow sign extension for int type call parameters (PR #84874)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 12 10:31:59 PDT 2024


================
@@ -22,6 +22,19 @@ class BPFABIInfo : public DefaultABIInfo {
 public:
   BPFABIInfo(CodeGenTypes &CGT) : DefaultABIInfo(CGT) {}
 
+  bool isPromotableIntegerTypeForABI(QualType Ty) const {
+    if (ABIInfo::isPromotableIntegerTypeForABI(Ty) == true)
+      return true;
+
+    if (const auto *BT = Ty->getAs<BuiltinType>()) {
+      // For 'signed int' type, return true to allow sign-extension.
+      if (BT->getKind() == BuiltinType::Int)
----------------
yonghong-song wrote:

> should BuiltinType::UInt be included as well?

Yes, make sense. I will add that as well.

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


More information about the cfe-commits mailing list